【精華】架構合理+強大的PHP架構再次推薦,傲視群雄~~~~
樣本展示
PHP code
display("lizi1.html"); } //擷取配置項 public function getC(){ $this->assign('cdata',C('static_url')); $this->display('c.html'); } //跳轉方法 public function jump(){ $this->redirect("Index/lizi1.html"); } //增加資料,常規操作 public function adddata(){ $data['title']='ChangShu'; $this->add($data,"demo"); $this->redirect("Index/lizi1.html"); } //更新資料 public function savedata(){ $data['title']='ChangShu2'; $this->save($data,"demo",1); $this->redirect("Index/lizi1.html"); } //尋找單條資料集 public function finddata(){ $data=$this->find("demo","string",1); $this->assign('data',$data); $this->display('find.html'); } //尋找資料集合 public function seldata(){ $data=$this->select("select * from demo where id between 1 and 3"); $this->assign('data',$data); $this->display('sel.html'); } //刪除資料,略 //資料表執行個體化操作 public function tadd(){ $u=T("demo"); $u->title='nantong'; $u->add(); $this->redirect("Index/lizi1.html"); } //執行個體化更新資料 public function tsave(){ $u=T("demo"); $u2=$u->find(1); $u2->title='SUZHOU'; $u2->save(); $this->redirect("Index/lizi1.html"); } //尋找資料集,,集合等等,省略,,參閱中文手冊 //多語言,要修改lng/lang.php public function lang(){ $this->display('lang.html'); } //驗證方法,要修改Model/Model.php public function vali(){ $data=''; //$data="hell"; if(match($data,"title")){ $this->redirect("Index/lizi1.html"); } } //二維數組調用函數,使用common/common.php public function common(){ $u=T("demo"); $data=$u->select("1,2,3"); $this->assign('data',$data); $this->display("common.html"); } //大型複雜項目迴圈數組運算使用,注意$this->array_array $this->array_two的用法 public function dophp(){ $data=$this->select("select * from demo"); $this->assign('data',$data); $this->display('fuza.html'); }}?>
――――――――――――――――――――――――――――――――――――――――――――――――
lizi1.html 偽靜態配置
HTML code
這是一個偽靜態樣本,具體實現參考代碼。。
在conf/config.php中設定 'static_url'=>'.html',
―――――――――――――――――――――――――――――――――――――――――――――――――
c.html 擷取配置項
HTML code
輸出值為:{cdata}
其中 {cdata} 輸出模板變數
――――――――――――――――――――――――――――――――――――――――――――――――