[2] ErrorException in Index.php line 38

Invalid argument supplied for foreach()

  1. if(!in_array($url,$arr)){
  2. $url = $arr[0];
  3. }
  4. $urlHd = $url;
  5. $this->company_id = Db::table('cs_company')->where('company_pym', $urlHd)->value('id');
  6. $this->company_name = Db::table('cs_company')->where('id', $this->company_id)->value('company_name');
  7. $this->language = Db::table('cs_company')->where('id', $this->company_id)->value('language');
  8. $b = json_decode($this->language);
  9. $arr = [];
  10. foreach($b as $k => $v){
  11. $arr[$k] = $v;
  12. }
  13. $this->language = $arr;
  14. }
  15. public function index()
  16. {
  17. $url = $_SERVER['HTTP_HOST'];
  18. $urlHd = $url;

Call Stack

  1. in Index.php line 38
  2. at Error::appError(2, 'Invalid argument sup...', '/www/wwwroot/www.csi...', 38, ['url' => 'www.eiderwarmth.cn', 'arr' => [], 'urlHd' => 'www.eiderwarmth.cn', ...]) in Index.php line 38
  3. at Index->initialize() in Controller.php line 68
  4. at Controller->__construct(object(App))
  5. at ReflectionClass->newInstanceArgs([object(App)]) in Container.php line 439
  6. at Container->invokeClass('app\index\controller...', []) in Container.php line 284
  7. at Container->make('app\index\controller...', []) in App.php line 723
  8. at App->controller('index', 'controller', false, 'Error') in Module.php line 94
  9. at Module->exec() in Dispatch.php line 168
  10. at Dispatch->run() in App.php line 432
  11. at App->think\{closure}(object(Request), object(Closure), null)
  12. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  13. at Middleware->think\{closure}(object(Request))
  14. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  15. at Middleware->dispatch(object(Request)) in App.php line 435
  16. 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 www.eiderwarmth.cn
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.csigroup.com
SERVER_PORT 80
SERVER_ADDR 172.24.37.237
REMOTE_PORT 58548
REMOTE_ADDR 3.236.145.110
SERVER_SOFTWARE nginx/1.20.2
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/www.csigroup.com/public
DOCUMENT_URI /index.php
REQUEST_URI /index/index/news/id/291
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/index/index/news/id/291
SCRIPT_FILENAME /www/wwwroot/www.csigroup.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711631824.1063
REQUEST_TIME 1711631824
Environment Variablesempty
ThinkPHP Constantsempty