Joke Collection Website - Blessing messages - I use thinkphp as the WeChat interface class file. When I encounter a problem, how can I pass the variable to the instantiated class by getting a token?

I use thinkphp as the WeChat interface class file. When I encounter a problem, how can I pass the variable to the instantiated class by getting a token?

Class? Exponential action? Extension? Action? {

Public? Function? index()? {

$token? =? d(“wx _ token“)-& gt; Field ("Add ip",? Right)-"; select();

foreach? ($token? As what? $key? = & gt? $v)? {

What if? ($ v【‘expire _ time‘】? -? 300? & lt? time())? {

$url? =? “/cgi-bin/token? grant_type=client_credential。 appid = { $ v【‘appid‘】} & amp; secret = { $ v【‘secret‘】}“;

$res? =? File acquisition content ($url,? Fake);

$ this-& gt; getAccessToken($ v【‘id‘】,? $ RES);

} Otherwise {

$ date? =? Date ("Y-m-d? H:i:s“)? ;

Echo? “{$date}_____no? Expired \r\n "? ;

}

}

}

Personal? Function? getAccessToken($ token,? $res)? {

$ symbol? =? Fake? ;

$json? =? JSON _ decode($ RES);

$ data【‘id‘】? =? $ token

$ data【‘access _ token‘】? =? $ JSON-& gt; access _ token

$ data【‘expire _ time‘】? =? time()? +? 7200;

$ data【‘add _ time‘】? =? time();

$ data【‘add _ IP‘】? =? ' 127.0.0. 1'? ;

$db? =? d(“wx _ token“);

$ db-& gt; start trans();

What if? (? $ db-& gt; Save (data) (

$ db-& gt; commit()? ;

$ symbol? =? Really? ;

} Otherwise {

$ db-& gt; Rollback ()? ;

$ symbol? =? Fake? ;

}

Return? $ symbol? ;

}

} Just create a data table and save it. It is best to get the whole scheduled task regularly.