[8] ErrorException in Books.php line 33

Trying to get property of non-object

  1. public function index($id)
  2. {
  3. $book = cache('book:' . $id);
  4. $tags = cache('tags:book:' . $id);
  5. if ($book == false) {
  6. $book = Book::with(['chapters' => function ($query) {
  7. $query->order('chapter_order');
  8. }])->find($id);
  9. $tags = [];
  10. if (!empty($book->tags) || is_null($book->tags)) {
  11. $tags = explode('|', $book->tags);
  12. }
  13. cache('book:' . $id, $book, null, 'redis');
  14. cache('tags:book:' . $id, $tags, null, 'redis');
  15. }
  16. $redis = new_redis();
  17. $day = date("Y-m-d", time());
  18. //以当前日期为键,增加点击数

Call Stack

  1. in Books.php line 33
  2. at Error::appError(8, 'Trying to get proper...', '/home/hhggm/htdocs/w...', 33, ['id' => '16619', 'book' => null, 'tags' => []]) in Books.php line 33
  3. at Books->index('16619')
  4. at ReflectionMethod->invokeArgs(object(Books), ['16619']) in Container.php line 395
  5. at Container->invokeReflectMethod(object(Books), object(ReflectionMethod), ['id' => '16619', 'convert' => false]) in Module.php line 132
  6. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  7. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  11. at Module->exec() in Dispatch.php line 168
  12. at Dispatch->run() in App.php line 432
  13. at App->think\{closure}(object(Request), object(Closure), null)
  14. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  17. at Middleware->dispatch(object(Request)) in App.php line 435
  18. at App->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookies
nav_switch booklist
Sessionempty
Server/Request Data
USER hhggm
HOME /home/hhggm
HTTP_X_VARNISH 30278925
HTTP_ACCEPT_ENCODING gzip
HTTP_GRACE none
HTTP_X_FORWARDED_FOR 54.226.222.183, 172.71.222.92, 127.0.0.1
HTTP_CF_IPCOUNTRY US
HTTP_CDN_LOOP cloudflare
HTTP_CF_CONNECTING_IP 54.226.222.183
HTTP_REFERER http://shudm.com/book/16619
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_CF_VISITOR {"scheme":"https"}
HTTP_X_FORWARDED_PROTO https
HTTP_CF_RAY 866d39f13fcd38ac-IAD
HTTP_X_REAL_IP 172.71.222.92
HTTP_X_FORWARDED_HOST llmmh.com
HTTP_HOST llmmh.com
PHP_VALUE error_log=/home/hhggm/logs/php/error.log; memory_limit=1G; max_execution_time=60; max_input_time=60; max_input_vars=10000; post_max_size=64M; upload_max_filesize=64M; auto_prepend_file=/home/hhggm/.varnish-cache/controller.php; date.timezone=UTC; display_errors=off;
HTTPS on
MGT 1
GEOIP_LONGITUDE
GEOIP_LATITUDE
GEOIP_CITY_CONTINENT_CODE
GEOIP_POSTAL_CODE
GEOIP_CITY
GEOIP_REGION
GEOIP_CITY_COUNTRY_NAME
GEOIP_CITY_COUNTRY_CODE3
GEOIP_CITY_COUNTRY_CODE
GEOIP_COUNTRY_NAME United States
GEOIP_COUNTRY_CODE3 USA
GEOIP_COUNTRY_CODE US
REDIRECT_STATUS 200
SERVER_NAME www.hhggm.com
SERVER_PORT 443
SERVER_ADDR 127.0.0.1
REMOTE_PORT
REMOTE_ADDR 172.71.222.92
SERVER_SOFTWARE nginx/1.21.4
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /home/hhggm/htdocs/www.hhggm.com/public
DOCUMENT_URI /index.php
REQUEST_URI /index.php?s=//book/16619
SCRIPT_NAME /index.php
SCRIPT_FILENAME /home/hhggm/htdocs/www.hhggm.com/public/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=//book/16619
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1710848832.3282
REQUEST_TIME 1710848832
Environment Variablesempty
ThinkPHP Constants
VARNISH_DEVELOPER_MODE false
VARNISH_GENERIC_CONTROLLER_VERSION 0.0.1
BOOKCTRL book
CHAPTERCTRL chapter
TAGCTRL tag
BOOKLISTACT booklist
SEARCHCTRL search
RANKCTRL rank
UPDATEACT update
AUTHORCTRL author
spider_db_conn xxx