[8] ErrorException in Index.php line 79

未定义数组索引: access_token

  1. public function get_token($appid,$secret){
  2. $token_data = @file_get_contents('/wechat_token.txt');
  3. if (!empty($token_data)) {
  4. $token_data = json_decode($token_data, true);
  5. $time = time() - $token_data['time'];
  6. if ($time > 3600) {
  7. $token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}";
  8. $token_res = $this->https_request($token_url);
  9. $token_res = json_decode($token_res, true);
  10. $token = $token_res['access_token'];
  11. $data = array(
  12. 'time' =>time(),
  13. 'token' =>$token
  14. );
  15. file_put_contents('/wechat_token.txt', json_encode($data));
  16. } else {
  17. $token = $token_data['token'];
  18. }
  19. }else{

Call Stack

  1. in Index.php line 79
  2. at Error::appError(8, 'Undefined index: acc...', '/www/wwwroot/ehlink....', 79, ['appid' => 'wx517a40405b155b68', 'secret' => 'a15761342001585ace5d...', 'token_data' => ['time' => 1690178206, 'token' => '70_7-q2wjarC_t200XAK...'], ...]) in Index.php line 79
  3. at Index->get_token('wx517a40405b155b68', 'a15761342001585ace5d...') in Index.php line 53
  4. at Index->getConfig() in Index.php line 12
  5. at Index->index()
  6. at ReflectionMethod->invokeArgs(object(Index), []) in Container.php line 395
  7. at Container->invokeReflectMethod(object(Index), object(ReflectionMethod), []) in Module.php line 131
  8. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  9. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  10. at Middleware->think\{closure}(object(Request))
  11. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  12. at Middleware->dispatch(object(Request), 'controller') in Module.php line 136
  13. at Module->exec() in Dispatch.php line 168
  14. at Dispatch->run() in App.php line 432
  15. at App->think\{closure}(object(Request), object(Closure), null)
  16. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  17. at Middleware->think\{closure}(object(Request))
  18. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  19. at Middleware->dispatch(object(Request)) in App.php line 435
  20. at App->run() in index.php line 33

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
FCGI_ROLE RESPONDER
SCRIPT_FILENAME /www/wwwroot/ehlink.com.cn/public/index.php
QUERY_STRING
REQUEST_METHOD GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME /index.php
REQUEST_URI /
DOCUMENT_URI /index.php
DOCUMENT_ROOT /www/wwwroot/ehlink.com.cn/public
SERVER_PROTOCOL HTTP/1.1
REQUEST_SCHEME http
GATEWAY_INTERFACE CGI/1.1
SERVER_SOFTWARE nginx/1.18.0
REMOTE_ADDR 44.200.230.43
REMOTE_PORT 58654
SERVER_ADDR 172.19.16.56
SERVER_PORT 80
SERVER_NAME 106.15.191.148
REDIRECT_STATUS 200
PATH_INFO
HTTP_ACCEPT */*
HTTP_USER_AGENT claudebot
HTTP_HOST ehlink.com.cn
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711678659.7588
REQUEST_TIME 1711678659
Environment Variablesempty
ThinkPHP Constants
VT_VERSION 1.0
VT_RELEASE 20190516
VT_WIN false
VT_FMOD 511
VT_ROOT /www/wwwroot/ehlink.com.cn/public/
PHP_FLOAT_DIG 15
PHP_FLOAT_EPSILON 2.2204460492503E-16
PHP_FLOAT_MIN 2.2250738585072E-308
PHP_FLOAT_MAX 1.7976931348623E+308
PHP_OS_FAMILY Linux
QINIU_FUNCTIONS_VERSION 7.2.7