Is there a syntax error in the first if statement? Object-oriented is right, the object-oriented is the wrong class Wechat_base_api{public function Get_access_token () {require_once (' connect.php '); $tim =time (); $sql = "SELECT * from Get_access_token where id=0 and updated_time> $tim"; $resu = mysql_query ($sql); if ($resu) {$row =mysql_fetch_assoc ($resu); $access _token= $row [' content ']; return $access _token; }else{$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx5d4c 7d2e8ffd5793&secret=4379ef7213c36eae5dc2ab91f9f6aced "; $access _token_arr = $this->https_request ($url); $access _token= $access _token_arr[' Access_token '; $newtime =time () +7200; $SQLL = "Update Get_access_token set content= ' {$access _token} ', Updated_time= $newtime where id=0 "; mysql_query ($SQLL); return $access _token_arr[' Access_token ']; } }}
Reply content:
Is there a syntax error in the first if statement? Object-oriented is right, the object-oriented is the wrong class Wechat_base_api{public function Get_access_token () {require_once (' connect.php '); $tim =time (); $sql = "SELECT * from Get_access_token where id=0 and updated_time> $tim"; $resu = mysql_query ($sql); if ($resu) {$row =mysql_fetch_assoc ($resu); $access _token= $row [' content ']; return $access _token; }else{$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx5d4c 7d2e8ffd5793&secret=4379ef7213c36eae5dc2ab91f9f6aced "; $access _token_arr = $this->https_request ($url); $access _token= $access _token_arr[' Access_token '; $newtime =time () +7200; $SQLL = "Update Get_access_token set content= ' {$access _token} ', Updated_time= $newtime where id=0 "; mysql_query ($SQLL); return $access _token_arr[' Access_token ']; } }}
Object-oriented is right, object-oriented is wrong
I don't know what you're asking.
Look $resu
what it is.
mysql_query
so you can use it so directly?
Since all objects are object-oriented, the database is also referenced manually