(i) WeChat public number development basic configuration, Letter public Development Basic Configuration _php Tutorial

Source: Internet
Author: User
Tags sha1 sha1 encryption url example

(i) Public number development basic configuration, Letter public development Basic configuration


As a developer of code or to implement event response functions, the development of basic configuration is an essential part, this article roughly comb the development of the configuration process.

1. Log in to the public platform: Development---> Basic configuration

2, in the Basic Configuration page has "server Configuration", the default is not enabled state, we need to click "Modify Configuration" to complete the relevant project

3, fill in the following project content

  • URL: Must start with/HTTP, only 80 ports are currently supported, the server address must be a valid address accessible ( Note: In this article, the URL example, once saw a blog post to fill the URL address Http://tx.heivr.com/token, But the actual development of the pro-test can not respond to events, modify the URL to the specific file can be successful );
  • Encodingaeskey can be randomly generated;
  • token: Special emphasis is placed on the URL required to respond to tokens, so in index.php need to verify, the code is as follows:
    1 
       Php2 Define("token", "fill in the token value you set here");3 4 $WECHATOBJ=NewCallbackapi;5 $WECHATOBJ-valid ();6 7 classCallbackapi {8 9     /**Ten * Signature Verification One * @return [Type] [description] A      */ -       Public functionvalid () { -         $echoStr=$_get["Echostr"]; the         $signature=$_get["Signature"]; -         $timestamp=$_get["Timestamp"]; -         $nonce=$_get["Nonce"]; -         $token=TOKEN; +         //sort tokens, timestamp, and nonce by dictionary order -         $TMPARR=Array($token,$timestamp,$nonce); +         Sort($TMPARR);  A         $tmpStr=implode($TMPARR); at         //SHA1 encryption for TMPSTR -         $tmpStr=SHA1($tmpStr); -         if($tmpStr==$signature){ -             Header(' Content-type:text '); -             Echo $echoStr; -             Exit; in         } -     } to}

    Run index.php in the browser if the program is correct, you can see the returned string, complete the verification at this time, and fill in the token in the code to the appropriate location in the base configuration, click Submit. ( Note: The "token verification failed" Prompt may appear after the submission, if the check code and the parameters are correct, you need a few clicks to submit the success )

4, after the successful submission, click on the "Open" button, that is, to enter the developer mode, the mode after the function---> custom menu and other functions that are not available, if you want to use click "Deactivate" can

hereby DECLARE: The relevant articles are to consult the information, read the great God after the actual development of the situation encountered problems collated, can find Yumbo will be signed, find the original Bo and quoted content also hope the original Bo master Haihan

http://www.bkjia.com/PHPjc/1087776.html www.bkjia.com true http://www.bkjia.com/PHPjc/1087776.html techarticle (i) Public number development basic configuration, the public development of basic configuration as a developer with code or to implement event response, and other functions, the development of basic configuration is essential ...

  • 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.