phphub5安装后报错Trying to get property of non-object (View ?

报错信息

Whoops, looks like something went wrong.

3/3
ErrorException in 39b255622d2f2e5a618436d895ff4a05 line 47:
Trying to get property of non-object (View: /home/wwwroot/phphub5/resources/views/share_links/partials/share_links.blade.php) (View: /home/wwwroot/phphub5/resources/views/share_links/partials/share_links.blade.php)

2017-09-22_144357.png

我的处理

app/Http/Controllers/CategoriesController.php

 21         if ($category->id == config('phphub.hunt_category_id')) {
 22             $topics->load('share_link');
 23             //$view = 'share_links.index';
 24             $view = 'topics.index';       
 25         } else {

如果我装模板文件替换成 topics.index 就不报错了, 为什么使用share_links.index就会呢?

phphub5-github

阅读 1.5k
评论 2017-09-22 提问
    1 个回答
    string
    • 173

    share_links.index 模版里面有用到一个对象访问一个属性 该属性不存在就会报错

    比如 echo $log->tid 应该兼容性写成 echo isset($log->tid)? $log->tid :''

    评论 赞赏 2017-09-22
      撰写回答

      登录后参与交流、获取后续更新提醒