YYUC安装
- 假设本地项目目录为
test, 将yyuc解压并复制到test下。 - 将
yyuc下的forders复制到yyuc同级目录下, 目录结构如下,forders名称可以自己修改。后续自己修改为wx
- test
- - forders
- - yyuc 后期修改为 wx
- 本地环境启动目录设置为
test/forders nginx伪静态设置为
try_files $uri $uri/ /index.php?$query_string;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
- php 版本为
5.3,php7以上会报错。例如mysql_collect等数据库连接方法,php7以后都舍弃了。
hello world
方式一
- 在
wx/controller下新建/demo/hello.php - 内部代码为
<?php
Page::ignore_view(); //忽略视图
Response::write("hello world"); //直接写入
?>
- 访问地址
http://x.com/demo/hello.php
方式二
- 在
wx/controller下新建/demo/hello.php, 内容为空 - 在
wx/view/default下新建/demo/hello.html, 里面输入html内容 - 访问地址
http://x.com/demo/hello.php
方式三
- 修改配置文件
wx/conf.php将$auto_find_view改为true
/**是否开启无控制器时自动寻找对应视图~默认:false*/
public static $auto_find_view = true;
- 无需创建控制器文件直接建立文件,例在
wx/view/default下新建/demo/hello.html, 里面输入html内容 - 访问地址
http://x.com/demo/hello.php
配置数据库
- 在
wx/conf.php中配置 - 配置如下
/**数据库地址~*/
public static $db_host = "localhost";
/**数据库端口~*/
public static $db_port = "3306";
/**数据库名~*/
public static $db_dbname = "test";
/**数据库用户名~*/
public static $db_username = "root";
/**数据库密码~*/
public static $db_password = "root";
/**数据库表前缀~为了区分同一个数据库中不同框架的数据表,建议设置此项。*/
public static $db_tablePrefix = "qq_";
模板标签
| 表单项 | 对应html | 备注 |
|---|---|---|
| all | <textarea></textarea> | 模型所有非空属性的表单集合(隐藏的) |
| text | <input typr=“text” /> | 文本输入 |
| password | <input type=“password” /> | 密码框 |
| <input type=“email”> | 邮件输入框(html5) | |
| range | <input type=“range”> | 程度选择框(html5) |
| hidden | <input type=“hidden”> | 隐藏标签 |
| textarea | <textarea></textarea> | 文本框 |
| checkbox | <input type=“checkbox”> | 多选按钮 |
| select | <select></select> | 下拉框 |
| radio | <input type=“radio”> | 单选按钮 |
| date | <input type=“text”> | 时间选择 |
| datetime | <input type=“text”> | 时间日期选择 |
| texteditor | <textarea></textarea> | 富文本编辑器 |
| color | <input type=“text”> | 颜色选择框 |
| vercode | <input type=“text”> | 验证码输入框 |
| upload | <input type=“file”> | 文件上传 |
举例
- php文件中
$note = new Model('notes');
- html中应用
{$note->lable('title')} : {$note->title} <br>
{$note->lable('author')} : {$note->author} <br>
{$note->lable('theme')} : {$note->field_text('theme')} <br>
{$note->lable('postdate')} : {$note->postdate} <br>
{$note->lable('bepublished')} : {$note->field_text('bepublished')} <br>
{$note->lable('content')} : {$note->content}
视图模板的引用
- 创建规图文件:
view/default/notes/navigation.html - 在所有视图文件中的
body标签下方都引入此视图
{T navigation}
1740

被折叠的 条评论
为什么被折叠?



