class MembersModel extends Model {
public function test(){
echo "test";
}
}
action 调用
public function test() {
$Members = D("Members");
$Members->test();
}
模型名称大小写均匹配,为什么调用
:(
Model:test您所请求的方法不存在!
错误位置
FILE: F:\lhb\webroot\app1\ThinkPHP\Lib\Core\Model.class.php LINE: 253
http://www.thinkphp.cn/topic/7496.html
在历史遗留问题里面找到也有出现相同问题,单没人能答复,
但是当加载具体类库的时候new出来可以调用,用D方法初始化的类无法调用自定义方法。
require_once '/Admin/Lib/Model/AuthModel.php';
$auth=new AuthModel();
$auth->test();//可以调用
最佳答案
