guoda 发表于 2013-3-26 13:10:54

菜鸟询问:controller里面的方法可否改为 例如 indexAction(){} ?

因为在别的框架里用这种 比较习惯
还有assign() 和render()
请问CI支持这样的吗?

smallhe 发表于 2013-3-26 13:37:35

结合smarty后 可以

caipeijie 发表于 2013-3-26 16:00:24

最简单的就在system/core/Router.php里面

function fetch_method()
        {
                if ($this->method == $this->fetch_class())
                {
                        return 'index';
                }
                //$this->method = $this->method . 'Action'; 加上这句
                return $this->method;
        }

render方法你可以在loader里面加上这个方法。

dickfu 发表于 2013-3-26 17:16:17

本帖最后由 dickfu 于 2013-3-26 19:49 编辑

Action那个改扩展CI_Route写个MY_Route
assign和render自己扩展CI_Controller,实现这两个方法呗,
里面就是this->load->vars和this->load->view

就行了呗
页: [1]
查看完整版本: 菜鸟询问:controller里面的方法可否改为 例如 indexAction(){} ?