PHP WeChat Development, ask Daniel to look at the problem there

Source: Internet
Author: User
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_queryso you can use it so directly?

Since all objects are object-oriented, the database is also referenced manually

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.