1、控制器

一个控制器的例子:

class IndexController extends Controller{
    function function index(){
        echo "<h1>Hello Aiiphp v".VERSION."</h1>";
    }
}

每个控制器都要继承父控制器,以便能够使用父控制器的方法。

1.1、控制器属性:

    默认的模块名
    public $module = 'home';

    控制器方法名称
    public $control = 'index';

    动作方法名字
    public $action = 'index';

1.2、控制器方法:

1、模板赋值: $this->assign($keys, $value = null)

2、显示模板(支持模式admin@home/test): $this->display();

3、加载模型,MVC中的M : $this->model($model = '')

results matching ""

    No results matching ""