API错误:https://tcmcb.com/api.php?s=article/getInfo&lang=en; 参数:id=16
系统发生错误

#0 [0]Error in common.php line 389

Only arrays and Traversables can be unpacked

  1. $reserves=[];
  2. if($reserveStrs!=""){
  3. $reserves = explode(',',$reserveStrs);
  4. }
  5. foreach($list as $key => $item) {
  6. $reserveFields = [];
  7. foreach($reserves as $name){
  8. $reserveFields[$name] = $item[$name];
  9. }
  10. $newList[]=[...$item[$keyName],...$reserveFields];
  11. }
  12. $newList=setCurLangForList($newList);
  13. return $newList;
  14. }
  15. //获得当前语言的值,例如当前语言为cn,传入 $info=array,$fieldName=name,则返回 $info['cn_name'] 的值
  16. function getCurLangValue($info,$fieldName){
  17. //获得当前语言标识
  18. $curLangIdentifier = lang('identifier');

Call Stack

  1. in common.php line 389
  2. at setCurLangForAssociation() in ArticleController.php line 63
  3. at ArticleController->getInfo()
  4. at ReflectionMethod->invokeArgs() in Container.php line 345
  5. at Container->invokeReflectMethod() in Controller.php line 110
  6. at Controller->think\route\dispatch\{closure}() in Pipeline.php line 59
  7. at Pipeline->think\{closure}() in Pipeline.php line 66
  8. at Pipeline->then() in Controller.php line 113
  9. at Controller->exec() in Dispatch.php line 52
  10. at Dispatch->run() in Route.php line 755
  11. at Route->think\{closure}() in Pipeline.php line 59
  12. at Pipeline->think\{closure}() in Pipeline.php line 66
  13. at Pipeline->then() in Route.php line 756
  14. at Route->dispatch() in Http.php line 208
  15. at Http->dispatchToRoute() in Http.php line 198
  16. at Http->think\{closure}() in Pipeline.php line 59
  17. at Pipeline->think\{closure}() in MultiApp.php line 51
  18. at MultiApp->think\app\{closure}() in Pipeline.php line 59
  19. at Pipeline->think\{closure}() in SessionInit.php line 58
  20. at SessionInit->handle()
  21. at call_user_func() in Middleware.php line 134
  22. at Middleware->think\{closure}() in Pipeline.php line 85
  23. at Pipeline->think\{closure}() in LoadLangPack.php line 53
  24. at LoadLangPack->handle()
  25. at call_user_func() in Middleware.php line 134
  26. at Middleware->think\{closure}() in Pipeline.php line 85
  27. at Pipeline->think\{closure}() in Pipeline.php line 66
  28. at Pipeline->then() in MultiApp.php line 52
  29. at MultiApp->handle()
  30. at call_user_func() in Middleware.php line 134
  31. at Middleware->think\{closure}() in Pipeline.php line 85
  32. at Pipeline->think\{closure}() in Pipeline.php line 66
  33. at Pipeline->then() in Http.php line 199
  34. at Http->runWithRequest() in Http.php line 162
  35. at Http->run() in api.php line 29

Environment Variables

GET Data
lang en
POST Data
id 16
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_CONTENT_TYPE application/x-www-form-urlencoded
HTTP_CONTENT_LENGTH 5
HTTP_COOKIE
HTTP_ACCEPT */*
HTTP_HOST tcmcb.com
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME tcmcb.com
SERVER_PORT 443
SERVER_ADDR 172.31.126.252
REMOTE_PORT 37786
REMOTE_ADDR 47.242.177.151
SERVER_SOFTWARE nginx/1.24.0
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /home/wwwroot/tcmcb.com/public
DOCUMENT_URI /api.php
REQUEST_URI /api.php?s=article/getInfo&lang=en
SCRIPT_NAME /api.php
CONTENT_LENGTH 5
CONTENT_TYPE application/x-www-form-urlencoded
REQUEST_METHOD POST
QUERY_STRING s=article/getInfo&lang=en
SCRIPT_FILENAME /home/wwwroot/tcmcb.com/public/api.php
FCGI_ROLE RESPONDER
PHP_SELF
REQUEST_TIME_FLOAT 1726779615.404
REQUEST_TIME 1726779615