public function get_token($appid,$secret){
$token_data = @file_get_contents('/wechat_token.txt');
if (!empty($token_data)) {
$token_data = json_decode($token_data, true);
$time = time() - $token_data['time'];
if ($time > 3600) {
$token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}";
$token_res = $this->https_request($token_url);
$token_res = json_decode($token_res, true);
$token = $token_res['access_token'];
$data = array(
'time' =>time(),
'token' =>$token
);
file_put_contents('/wechat_token.txt', json_encode($data));
} else {
$token = $token_data['token'];
}
}else{
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 |
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 |