这个报错,找不到原因·····
类的属性不存在:app\index\model\Topic->praises_count
public function detail(){
$topicId=input('get.id');
$topic=TopciModel::getTopic($topicId);
$user=session('user');
$this->assign([
'user'=>$user,
'topic'=>$topic,
'topicTags' => TopicTag::getTopicTagsByTopicId($topic->id),
'categoryNames' => getCategoryNames($topic->category_id),
]);
echo $this->fetch('detail');
}
class TopicTag extends Model{
public static function getTopicTagsByTopicId($topicId){
return self::where(['topic_id'=>$topicId])->select();
}
public function tag(){
return $this->belongsTo('Tag','tag_id');
}
}
class Topic extends Model
{
public static function getTopic($id){
return self::find(['id'=>$id]);
}
public function user(){
return $this->belongsTo('User','user_id');
}
}13
收起
正在回答 回答被采纳积分+1
2回答
相似问题
登录后可查看更多问答,登录/注册
PHP常用技术与ThinkPHP5框架开发
- 参与学习 人
- 提交作业 225 份
- 解答问题 3372 个
掌握用PHP开发互联网网站的必备功能,掌握当下主流的Linux系统开发,并熟练使用热门框架ThinkPhp开发电商团购项目,是通向PHP工程师必经之路。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星