Home > Backend Development > PHP Tutorial > PHP development of WeChat public account (basics) - play with it, php basics_PHP tutorial

PHP development of WeChat public account (basics) - play with it, php basics_PHP tutorial

WBOY
Release: 2016-07-12 08:52:34
Original
921 people have browsed it

PHP Development of WeChat Public Account (Basics) - Play with it, PHP Basics

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

Then I unexpectedly 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 are requests, from right to left are responses;

1.2 API

--Configuration

Access API

Enter these two - therefore, prepare the server in advance. I use Tencent's. Anyway, they are all owned by the same company, so it is 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>
Copy after login

The main thing is this piece of code, just put it in the URL you want to link to.

The specific reason is based on the regulations of Weixin. I don’t know much about it, so I have to check it out.

Develop something to play with tomorrow

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1126843.htmlTechArticlePHP Development of WeChat Public Account (Basics) - Play around, PHP Basics has been opened recently WeChat account, write something to your family or something, if you want to read it, this is it:...
Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template