生活随笔
收集整理的這篇文章主要介紹了
YYUC框架
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
YYUC安裝
假設(shè)本地項目目錄為 test, 將yyuc解壓并復(fù)制到test下。將 yyuc 下的forders復(fù)制到y(tǒng)yuc同級目錄下, 目錄結(jié)構(gòu)如下,forders名稱可以自己修改。后續(xù)自己修改為 wx
- test
- - forders
- - yyuc 后期修改為 wx
本地環(huán)境啟動目錄設(shè)置為 test/fordersnginx偽靜態(tài)設(shè)置為
try_files $uri $uri/ /index.php?$query_string;
if (!-e $request_filename){ rewrite ^/(.*) /index.php last;
}
php 版本為5.3,php7以上會報錯。例如mysql_collect等數(shù)據(jù)庫連接方法,php7以后都舍棄了。
hello world
方式一
在 wx/controller 下新建 /demo/hello.php內(nèi)部代碼為
<?phpPage
::ignore_view(); Response
::write("hello world");
?>
訪問地址 http://x.com/demo/hello.php
方式二
在 wx/controller 下新建 /demo/hello.php, 內(nèi)容為空在 wx/view/default 下新建 /demo/hello.html, 里面輸入html內(nèi)容訪問地址 http://x.com/demo/hello.php
方式三
修改配置文件 wx/conf.php 將 $auto_find_view 改為 true
public static $auto_find_view = true;
無需創(chuàng)建控制器文件直接建立文件,例在 wx/view/default 下新建 /demo/hello.html, 里面輸入html內(nèi)容訪問地址 http://x.com/demo/hello.php
配置數(shù)據(jù)庫
在 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_";
模板標(biāo)簽
表單項對應(yīng)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”> | 隱藏標(biāo)簽 |
| 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中應(yīng)用
{$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}
視圖模板的引用
創(chuàng)建規(guī)圖文件:view/default/notes/navigation.html在所有視圖文件中的 body標(biāo)簽下方都引入此視圖
{T navigation}
分頁
總結(jié)
以上是生活随笔為你收集整理的YYUC框架的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。