日期:2014-05-17  浏览次数:20574 次

【精华】架构合理+强大的PHP框架再次推荐,傲视群雄~~~~
示例展示

PHP code
<?php
class IndexAction extends YouYaX
{
        //伪静态设置.html,注意这里配置了,下面全都要加上.html
        public function lizi1()
        {
            header("Content-type: text/html; charset=utf-8");                        
            $this->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
<include file="Tpl/top.html">
<include file="Tpl/menu.html">
    这是一个伪静态示例,具体实现参考代码。。
<include file="Tpl/foot.html">    


在conf/config.php中设置 'static_url'=>'.html',

—————————————————————————————————————————————————

c.html 获取配置项
HTML code
<include file="Tpl/top.html">
<include file="Tpl/menu.html">
输出值为:{cdata}
&