Home  >  Article  >  Backend Development  >  PHP Development of WeChat Public Accounts (Basics) - Play with it How to apply for a WeChat public account WeChat public account platform material library WeChat public account application letter

PHP Development of WeChat Public Accounts (Basics) - Play with it How to apply for a WeChat public account WeChat public account platform material library WeChat public account application letter

WBOY
WBOYOriginal
2016-07-29 08:49:061187browse

Recently I opened a WeChat account to write something to my family and so on. If you want to read it, this is it:

PHP Development of WeChat Public Accounts (Basics) - Play with it How to apply for a WeChat public account WeChat public account platform material library WeChat public account application letter

Then I accidentally saw the WeChat public account development on imooc. I’m exhausted from doing scientific research every day, so let’s do something that’s not so tiring.

WeChat public account development

1. Basics

1.1 Data interaction process

User "————" WeChat server "————" Third-party server;

And, from left to right, they are request, from right to left are responses;

1.2 API

--Configuration

Access API

PHP Development of WeChat Public Accounts (Basics) - Play with it How to apply for a WeChat public account WeChat public account platform material library WeChat public account application letter

Enter these two--so, prepare the server in advance , I use Tencent’s, since they are all owned by the same company, so it’s more convenient.

<span>$timestamp</span>=<span>$_GET</span>['timestamp'<span>];
</span><span>$nonce</span>=<span>$_GET</span>['nonce'<span>];
</span><span>$token</span>='weixin'<span>;
</span><span>$signature</span>=<span>$_GET</span>['signature'<span>];
</span><span>$array</span>=<span>array</span>(<span>$timestamp</span>,<span>$nonce</span>,<span>$token</span><span>);
</span><span>sort</span>(<span>$array</span><span>);
</span><span>$tmpstr</span>=<span>implode</span>('',<span>$array</span><span>);
</span><span>$tmpstr</span>=<span>sha1</span>(<span>$tmpstr</span><span>);
</span><span>if</span> (<span>$tmpstr</span>==<span>$signature</span><span>){
  </span><span>echo</span><span>$_GET</span>['echostr'<span>];
  </span><span>exit</span><span>;
}</span>

Mainly just this piece of code, just put it in the URL you want to link to.

The specific reason is probably based on Weixin regulations. I don’t really understand it, so I’ll have to check it out.

Develop something to play with tomorrow

The above introduces the PHP development of WeChat public accounts (Basics) - play with it, including the content of WeChat public accounts. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn