我在ThinkPHP 3.1.3 里的自定义Model类中用 $this->where
结果报错:
Fatal error: Call to a member function select()我定义了一个/Lib/Model/DiquModel.class.php(表名称diqu),方法Class DiquModel extends Model{
public function _initialize(){
$this->cache = $this->select();
}
public function getSub(){
return $this->cache;
}
}然后在/Lib/Action/Home/IndexAction.class.php 的index方法中使用了D('Diqu')->getSub()结果报错!
class IndexAction extends Action{
public function index(){
$arr = D('Diqu')->getSub();
}
} 最佳答案