[0] ThrowableError in ContactCategory.php line 65

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

  1. $cid = $this->request->param('id/d');
  2. //如果cid为空,则获取顶级栏目下子栏目第一个id
  3. if (empty($cid)) {
  4. $firstCategory = $this->contact_category_model->where('status', 1)->order('sort asc, id asc')->find();
  5. $cid = $firstCategory['id'];
  6. }
  7. //当前分类
  8. $current = $this->contact_category_model->where('id', $cid)->where('status', 1)->find()->toArray();
  9. if (empty($current)) {
  10. return false;
  11. }
  12. //如果当前分类的path为空,1级栏目,则自动读取该栏目子栏目下的第一个id栏目
  13. $path_array = array_filter(explode(',', $current['path'])); //转化$path为数组,并过滤空值
  14. /* if (empty($path_array)) {
  15. $current = $this->contact_category_model->where('pid', $current['id'])->where('status', 1)->order('sort asc, id asc')->find();
  16. $cid = $current['id'];

Call Stack

  1. in ContactCategory.php line 65
  2. at ContactCategory->index()
  3. at ReflectionMethod->invokeArgs(object(ContactCategory), []) in Container.php line 395
  4. at Container->invokeReflectMethod(object(ContactCategory), object(ReflectionMethod), ['id' => '11', 'name' => 'representative', 'convert' => false]) in Module.php line 132
  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 137
  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 32

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST www.mornsun-power.jp
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.mornsunpower.jp
SERVER_PORT 443
SERVER_ADDR 172.18.60.110
REMOTE_PORT 34538
REMOTE_ADDR 54.81.136.84
SERVER_SOFTWARE nginx/1.18.0
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/2.0
DOCUMENT_ROOT /www/wwwroot/www.mornsunpower.jp/public
DOCUMENT_URI /index.php
REQUEST_URI /html/contact/11/representative.html
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/html/contact/11/representative.html
SCRIPT_FILENAME /www/wwwroot/www.mornsunpower.jp/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711717876.2063
REQUEST_TIME 1711717876
Environment Variablesempty
ThinkPHP Constants
ROOT_PATH /www/wwwroot/www.mornsunpower.jp/public/