[2] ErrorException in TemplateController.php line 464

array_filter() expects parameter 1 to be array, bool given

  1. * @throws \think\exception\DbException
  2. */
  3. public function siteMap(Request $request)
  4. {
  5. $newsList = News::where('domain_id', $this->domainId)->order('create_time', 'desc')->select();
  6. $xml = '<?xml version=\'1.0\' encoding=\'UTF-8\'?><urlset xmlns=\'http://www.sitemaps.org/schemas/sitemap/0.9\'>';
  7. $day = date('Y-m-d');
  8. $xml .= '<url><loc>' . 'http://www.' . $this->url . '</loc><priority>1.0</priority><lastmod>' . $day . '</lastmod><changefreq>Always</changefreq></url>';
  9. $list = array_filter(cache('area'));
  10. foreach ($list as $v) {
  11. $url = "http://" . $v . '.' . $this->url;
  12. $xml .= '<url><loc>' . $url . '</loc><priority>1.0</priority><lastmod>' . $day . '</lastmod><changefreq>Always</changefreq></url>';
  13. }
  14. if (!empty($newsList)) {
  15. foreach ($newsList as $item) {
  16. $local = 'http://www.' . $this->url . '/news/' . $item['id'] . '.html';
  17. $xml .= '<url><loc>' . $local . '</loc><priority>0.9</priority><lastmod>' . date('Y-m-d', $item['create_time']) . '</lastmod><changefreq>Always</changefreq></url>';
  18. }

Call Stack

  1. in TemplateController.php line 464
  2. at Error::appError(2, 'array_filter() expec...', '/www/wwwroot/vip.sho...', 464, ['request' => object(Request), 'newsList' => object(Collection), 'xml' => '<?xml version='1.0' ...', ...])
  3. at array_filter(false) in TemplateController.php line 464
  4. at TemplateController->siteMap(object(Request))
  5. at ReflectionMethod->invokeArgs(object(TemplateController), [object(Request)]) in Container.php line 395
  6. at Container->invokeReflectMethod(object(TemplateController), object(ReflectionMethod), ['convert' => false]) in Module.php line 131
  7. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  8. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  9. at Middleware->think\{closure}(object(Request))
  10. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  11. at Middleware->dispatch(object(Request), 'controller') in Module.php line 136
  12. at Module->exec() in Dispatch.php line 168
  13. at Dispatch->run() in App.php line 432
  14. at App->think\{closure}(object(Request), object(Closure), null)
  15. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  16. at Middleware->think\{closure}(object(Request))
  17. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  18. at Middleware->dispatch(object(Request)) in App.php line 435
  19. 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
HTTP_HOST jiangsu.xuemenglipin.cn
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.daxiywz.cn
SERVER_PORT 80
SERVER_ADDR 172.16.3.56
REMOTE_PORT 47090
REMOTE_ADDR 54.81.185.66
SERVER_SOFTWARE nginx/1.21.4
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/vip.shoupaiyun.net/public
DOCUMENT_URI /index.php
REQUEST_URI /siteMap.html
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/siteMap.html
SCRIPT_FILENAME /www/wwwroot/vip.shoupaiyun.net/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1710835817.7455
REQUEST_TIME 1710835817
Environment Variablesempty
ThinkPHP Constantsempty