加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

CakePHP控制器

发布时间:2020-12-13 17:09:22 所属栏目:PHP教程 来源:网络整理
导读:您好我正在为Cake PHP添加动态子菜单并收到此错误: Notice (8): Undefined property: PagesController::$GamesRewiewTypes 我创建了名为rewiew_types_controller.php的控制器,它不起作用? App_Controller.php: $rewiewTypes = $this-GamesRewiewTypes-fin
您好我正在为Cake PHP添加动态子菜单并收到此错误:

Notice (8): Undefined property: PagesController::$GamesRewiewTypes

我创建了名为rewiew_types_controller.php的控制器,它不起作用?

App_Controller.php:

$rewiewTypes = $this->GamesRewiewTypes->find('all',array('conditions' => array('GamesRewiewTypes.menu_show' => 1),'order' => 'GamesRewiewTypes.title ASC'));

    $rewiewTypes = Set::combine($rewiewTypes,'{n}.GamesRewiewTypes.title',array('/reviews/{0}','{n}.GamesRewiewTypes.id'));



    $mainMenu = array(

        '3dreviews' => $rewiewTypes,);

Rewiews_Type_Controller.php:

class RewiewTypesController extends AppController {
var $name = 'rewiewTypes';
var $uses = array('GamesRewiewTypes');

Pages_Controller.php:

class PagesController extends AppController {
var $uses = array('Banner');

public function index() {
    $banners = $this->Banner->find('all',array('order' => 'position ASC'));
    $this->set('banners',$banners);
    /*
    pr ($banners);
    exit;
    */
}

解决方法

用你的app_controller和pages_controller替换$uses

var $uses = array('Banner','GamesRewiewTypes');

这应该够了吧

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读