YYUC框架

YYUC安装
  1. 假设本地项目目录为 test, 将yyuc解压并复制到test下。
  2. yyuc 下的forders复制到yyuc同级目录下, 目录结构如下,forders名称可以自己修改。后续自己修改为 wx
- test
- - forders
- - yyuc 后期修改为 wx
  1. 本地环境启动目录设置为 test/forders
  2. nginx伪静态设置为
try_files $uri $uri/ /index.php?$query_string;
if (!-e $request_filename){  
    rewrite ^/(.*) /index.php last;  
}
  1. php 版本为5.3,php7以上会报错。例如mysql_collect等数据库连接方法,php7以后都舍弃了。

hello world

方式一

  1. wx/controller 下新建 /demo/hello.php
  2. 内部代码为
<?php
	Page::ignore_view(); //忽略视图
	Response::write("hello world"); //直接写入
?>
  1. 访问地址 http://x.com/demo/hello.php

方式二

  1. wx/controller 下新建 /demo/hello.php, 内容为空
  2. wx/view/default 下新建 /demo/hello.html, 里面输入html内容
  3. 访问地址 http://x.com/demo/hello.php

方式三

  1. 修改配置文件 wx/conf.php$auto_find_view 改为 true
/**是否开启无控制器时自动寻找对应视图~默认:false*/
public static $auto_find_view = true;
  1. 无需创建控制器文件直接建立文件,例在 wx/view/default 下新建 /demo/hello.html, 里面输入html内容
  2. 访问地址 http://x.com/demo/hello.php

配置数据库
  1. wx/conf.php中配置
  2. 配置如下
	/**数据库地址~*/
	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” />密码框
email<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”>文件上传

举例

  1. php文件中
$note = new Model('notes');
  1. 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}

视图模板的引用
  1. 创建规图文件:view/default/notes/navigation.html
  2. 在所有视图文件中的 body标签下方都引入此视图
{T navigation}

分页
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值