sola 发表于 2012-5-1 16:32:10

加载多个model的问题



class Video extends CI_controller{
            /**
                * 构造方法
                */
      function __construct(){
            parent::__construct();
                        $this->session->userdata['user_id']!='' ? : redirect('login');
                        $this->load->model('video_model','video');
                        //$this->load->model('user_model','user');
      }

/**
               * 方法名:video_category
               * 作用:查询分类名称
               * */
                private function video_category($category_id){
                        $this->load->model('category_model','category');
                        $result = $this->category->videoByCid($category_id);
                        file_put_contents('result.txt', var_export($result,true));
                }



然后出现这个问题

A PHP Error was encounteredSeverity: Notice
Message:Undefined property: Video::$category_model
Filename: controllers/video.php




phoenixg 发表于 2012-5-1 16:38:11

私有方法的问题吧

sola 发表于 2012-5-3 09:30:40

phoenixg 发表于 2012-5-1 16:38 static/image/common/back.gif
私有方法的问题吧

哪里有问题?看不出哪里有问题啊!!!

yuzhigang5460 发表于 2012-5-3 12:39:42

sola 发表于 2012-5-3 09:30 static/image/common/back.gif
哪里有问题?看不出哪里有问题啊!!!

private的问题?

sola 发表于 2012-5-5 10:26:25

yuzhigang5460 发表于 2012-5-3 12:39 static/image/common/back.gif
private的问题?

设置成public也不行呐 还是这外错误   是不是得改框架底层的model?
页: [1]
查看完整版本: 加载多个model的问题