[0] ThrowableError in News.php line 63

致命错误: Call to a member function newsImg() on null

  1. $this->assign('local', $local);
  2. return $this->fetch('index');
  3. }
  4. public function detail(){
  5. $id = Request::param('id');
  6. $news = new model\News();
  7. $cateSql = new model\NewsCate();
  8. $list = $news ->where(['trash'=> 1,'is_show'=>1,'id'=>$id]) ->order(['sort','id desc'])-> find();
  9. $img = $list -> newsImg() -> find();
  10. $cate = $list -> newsCate() -> find();
  11. $seo = $list -> newsSeo() -> find();
  12. $list['cate'] = $cate['cate_name'];
  13. $list['img'] = $img['img'];
  14. $list['alt'] = $img['alt'];
  15. $list['title'] = $seo['title'];
  16. $list['keywords'] = $seo['keywords'];
  17. $list['description'] = $seo['description'];
  18. $list['tag'] = $seo['tag'];

Call Stack

  1. in News.php line 63
  2. at News->detail()
  3. at ReflectionMethod->invokeArgs(object(News), []) in Container.php line 395
  4. at Container->invokeReflectMethod(object(News), object(ReflectionMethod), ['id' => '6', 'convert' => false]) in Module.php line 135
  5. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  6. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  7. at Middleware->think\{closure}(object(Request))
  8. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  9. at Middleware->dispatch(object(Request), 'controller') in Module.php line 140
  10. at Module->exec() in Dispatch.php line 168
  11. at Dispatch->run() in App.php line 432
  12. at App->think\{closure}(object(Request), object(Closure), null)
  13. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  14. at Middleware->think\{closure}(object(Request))
  15. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  16. at Middleware->dispatch(object(Request)) in App.php line 435
  17. at App->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
SCRIPT_NAME /index.php
REQUEST_URI /english/news_detail/6.html
QUERY_STRING s=english/news_detail/6.html
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/2.0
GATEWAY_INTERFACE CGI/1.1
REDIRECT_QUERY_STRING s=english/news_detail/6.html
REDIRECT_URL /english/news_detail/6.html
REMOTE_PORT 38716
SCRIPT_FILENAME /www/wwwroot/keqin/public/index.php
SERVER_ADMIN webmasterexample.com
CONTEXT_DOCUMENT_ROOT /www/wwwroot/keqin/public
CONTEXT_PREFIX
REQUEST_SCHEME https
DOCUMENT_ROOT /www/wwwroot/keqin/public
REMOTE_ADDR 54.159.116.24
SERVER_PORT 443
SERVER_ADDR 43.224.153.87
SERVER_NAME www.coachchem.com
SERVER_SOFTWARE Apache
SERVER_SIGNATURE <address>Apache Server at www.coachchem.com Port 443</address>
LD_LIBRARY_PATH /www/server/apache/lib
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HTTP_HOST www.coachchem.com
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
proxy-nokeepalive 1
H2_STREAM_TAG 7-3
H2_STREAM_ID 3
H2_PUSHED_ON
H2_PUSHED
H2_PUSH off
H2PUSH off
HTTP2 on
SSL_TLS_SNI www.coachchem.com
HTTPS on
SCRIPT_URI https://www.coachchem.com/english/news_detail/6.html
SCRIPT_URL /english/news_detail/6.html
REDIRECT_STATUS 200
REDIRECT_H2_STREAM_TAG 7-3
REDIRECT_H2_STREAM_ID 3
REDIRECT_H2_PUSHED_ON
REDIRECT_H2_PUSHED
REDIRECT_H2_PUSH off
REDIRECT_H2PUSH off
REDIRECT_HTTP2 on
REDIRECT_SSL_TLS_SNI www.coachchem.com
REDIRECT_HTTPS on
REDIRECT_SCRIPT_URI https://www.coachchem.com/english/news_detail/6.html
REDIRECT_SCRIPT_URL /english/news_detail/6.html
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711716839.9921
REQUEST_TIME 1711716839
Environment Variablesempty
ThinkPHP Constantsempty