【问题标题】:missing method public function index()缺少方法公共函数索引()
【发布时间】:2014-01-08 06:00:11
【问题描述】:

BusinessController 中缺少方法 错误:控制器BusinessController中未定义动作索引 错误:在文件 app/Controller/BusinessController.php 中创建 BusinessController::index()。

如果我添加此方法,它会将我带到主页。我想去business_index.ctp

这是我的控制器

App::uses('控制器', '控制器'); 类 BusinessController 扩展 AppController { 公共 $name = '企业'; public $components = array('Auth','RequestHandler','Cache'); public $uses = array('User','CreditHistory'); 公共函数 beforeFilter(){ 父::beforeFilter(); }

函数同步(){ $this->layout = $this->autoRender = false; } //管理仪表板 公共功能业务索引(){ $this->set('title','Dashboard'); $uid = $this->Auth->User('id'); $this->set('user_id',$uid); }

我在文件夹名称 Business 中有一个视图名称 business_index.ctp

不知道我做错了什么。

【问题讨论】:

    标签: cakephp-2.0


    【解决方案1】:

    你可以做重定向 $ this-> redirect ('business_index');在您的索引方法中或在 config/routes.php 中添加路由器规则。见http://book.cakephp.org/2.0/en/development/routing.html

    【讨论】:

      猜你喜欢
      • 2011-04-30
      • 1970-01-01
      • 2020-11-29
      • 1970-01-01
      • 1970-01-01
      • 2012-12-01
      • 2020-01-01
      • 1970-01-01
      • 2020-11-03
      相关资源
      最近更新 更多