(1) basic configuration of WeChat official account development and basic configuration of WeChat official account development-PHP Tutorial

Source: Internet
Author: User
Tags sha1 encryption
(1) basic configuration for public account development, and basic configuration for public development. (1) basic configuration for public account development, and basic configuration for public development as a function for developers using code or implementing event response, basic configuration development is essential (1) basic configurations for public account development and basic configurations for public development

As a developer using code or implementing functions such as event response, basic configuration development is essential. This article outlines the development configuration process.

1. log on to the public platform: Development ---> basic configuration

2. on the basic configuration page, there is "server configuration", which is disabled by default. you need to click "modify configuration" to fill in related items.

3. enter the following items

  • URL: it must start with http: //. Currently, only port 80 is supported. the server address must be an accessible valid address (note: use the URL in this article as an example, once I saw a blog post, I entered the URL address as http://tx.heivr.com/token. however, in my own development, the URL can be modified to a specific file );
  • EncodingAESKey can be randomly generated;
  • Token: it is particularly emphasized that the entered URL needs to respond to the token, so it needs to be verified in index. php. the code is as follows:
    1
       Valid (); 6 7 class CallbackAPI {8 9/** 10 * signature verification 11 * @ return [type] [description] 12 */13 public function valid () {14 $ echoStr = $ _ GET ["echostr"]; 15 $ signature = $ _ GET ["signature"]; 16 $ timestamp = $ _ GET ["timestamp"]; 17 $ nonce = $ _ GET ["nonce"]; 18 $ token = TOKEN; 19 // sort token, timestamp, and nonce in lexicographic order. 20 $ tmpArr = array ($ token, $ timestamp, $ nonce); 21 sort ($ tmpArr); 22 $ tmpStr = implode ($ tmpArr ); 23 // perform sha1 encryption on tmpStr 24 $ tmpStr = sha1 ($ tmpStr); 25 if ($ tmpStr ==$ signature) {26 header ('content-type: text '); 27 echo $ echoStr; 28 exit; 29} 30} 31}

    Run index. php in the browser. if the program is correct, the returned string is displayed, and the verification is completed. enter the token in the code to the corresponding position in the basic configuration, and click submit. (Note: After submission, a message indicating "failed token verification" may appear. if the code and parameters are correct, you must click submit several more times to submit the code)

4. after the submission is successful, click the "enable" button to enter the developer mode. after the mode is enabled, some features, such as custom menus, are unavailable, click "disable" if you want to use it.

I hereby declare that the relevant articles are based on the problems encountered in the actual development situation after reading the materials and reading the blog of The Great God. The original blog will be signed, if you cannot find the content referenced by the original blog, please refer to the original blogger Haihan.

Http://www.bkjia.com/PHPjc/1087776.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1087776.htmlTechArticle (a) the basic configuration of the public development, the basic configuration of the public development as a developer with code or to achieve the 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.