public function index()
{
$article = Article::get(2);
$res = $article->comm()->where('id=2')->find();
dump($res);die;
exit();
return $this->fetch('index/login');
}这是模型代码:<?php
namespace app\admin\model;
use think\Model;
class Article extends Model{
//定义关联方法
protected function comm(){
return $this->hasMany('Content','article_id','id');
}
}
?>结果运行的时候报错:method not exist:think\db\Query->comm 不理解哪里出错了?????
最佳答案