This article mainly shares with you how to verify the owner on WeChat, hoping to help everyone.
<?php //這兩個控制器是我本來就有的這里就不做演示 可以不繼承 這個控制器用到的東西 不依靠外面的東西 namespace Apps\Controller; use Common\Controller\AppBaseController; /** * 首頁 */ define("TOKEN", "");//定義你公眾號自己設(shè)置的token define("APPID", "");//填寫你微信公眾號的appid 千萬要一致啊 define("APPSECRET", "");//填寫你微信公眾號的appsecret 千萬要記得保存 以后要看的話就只有還原了 保存起來 有益無害 class WeChatController extends AppBaseController { //判斷是介入還是用戶 只有第一次介入的時候才會返回echostr function index() { //這個echostr呢 只有說驗證的時候才會echo 如果是驗證過之后這個echostr是不存在的字段了 $echoStr = $_GET["echostr"]; if ($this->checkSignature()) { echo $echoStr; //如果你不知道是否驗證成功 你可以先echo echostr 然后再寫一個東西 exit; } }//index end //驗證微信開發(fā)者模式接入是否成功 private function checkSignature() { //signature 是微信傳過來的 類似于簽名的東西 $signature = $_GET["signature"]; //微信發(fā)過來的東西 $timestamp = $_GET["timestamp"]; //微信傳過來的值 什么用我不知道... $nonce = $_GET["nonce"]; //定義你在微信公眾號開發(fā)者模式里面定義的token $token = "xiaochen"; //三個變量 按照字典排序 形成一個數(shù)組 $tmpArr = array( $token, $timestamp, $nonce ); // use SORT_STRING rule sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); //哈希加密 在laravel里面是Hash:: $tmpStr = sha1($tmpStr); //按照微信的套路 給你一個signature沒用是不可能的 這里就用得上了 if ($tmpStr == $signature) { return true; } else { return false; } }// checkSignature end //構(gòu)建一個發(fā)送請求的curl方法 微信的東西都是用這個 直接百度 function https_request($url, $data = null) { //這個方法我不知道是怎么個意思 我看都是這個方法 就copy過來了 $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); if (!empty($data)){ curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($curl); curl_close($curl); return $output; }//https_request end } //classend
The above is the detailed content of How to verify owner on WeChat. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

1. After opening WeChat, click the search icon, enter WeChat team, and click the service below to enter. 2. After entering, click the self-service tool option in the lower left corner. 3. After clicking, in the options above, click the option of unblocking/appealing for auxiliary verification.

Indian Financial System Code is the abbreviation. Indian bank branches participating in the electronic funds transfer system are identified by a special 11-character code. The Reserve Bank of India uses this code in internet transactions to transfer funds between banks. IFSC code is divided into two parts. Banks are identified by the first four characters, while branches are identified by the last six characters. NEFT (National Electronic Funds Transfer), RTGS (Real Time Gross Settlement) and IMPS (Immediate Payment Service) are some of the electronic transactions that require IFSC codes. Method Some common ways to validate IFSC codes using regular expressions are: Check if the length is correct. Check the first four characters. Checkthefifthcharacter.Che

We usually receive PDF files from the government or other agencies, some with digital signatures. After verifying the signature, we see the SignatureValid message and a green check mark. If the signature is not verified, the validity is unknown. Verifying signatures is important, let’s see how to do it in PDF. How to Verify Signatures in PDF Verifying signatures in PDF format makes it more trustworthy and the document more likely to be accepted. You can verify signatures in PDF documents in the following ways. Open the PDF in Adobe Reader Right-click the signature and select Show Signature Properties Click the Show Signer Certificate button Add the signature to the Trusted Certificates list from the Trust tab Click Verify Signature to complete the verification Let

In golang, Unicode encoding and rune type are required to verify whether the input is full-width characters. Unicode encoding is a character encoding standard that assigns a unique numeric code point to each character in the character set, which includes full-width characters and half-width characters. The rune type is the type used to represent Unicode characters in golang. The first step is to convert the input into a rune type slice. This can be converted by using golang's []rune type, e.g.

As a language, Golang provides many methods to facilitate our data verification and processing. Among them, verifying whether the input is English letters is a basic function. This article will introduce two ways to implement this function in Golang. 1. Use regular expressions A regular expression is an expression that can match text fragments. In Golang, we can use the regexp package in the standard library to process and match regular expressions. The following is a code example to verify whether the input is English letters

Golang is a high-performance, modern programming language that often involves string processing in daily development. Among them, validating whether the input is in uppercase letters is a common requirement. This article will introduce how to verify whether the input is uppercase letters in Golang. Method 1: Use the unicode package. The unicode package in Golang provides a series of functions to determine the encoding type of characters. For uppercase letters, the corresponding encoding range is 65-90 (decimal), so we can use unicod

With the development of the times, we pay more and more attention to the verification of data, especially the verification of user input. For language verification, how to accurately determine whether the input is all Chinese characters has become an important issue. In golang, we can use the unicode package and regexp package to achieve this requirement. 1. Unicode package The unicode package provides a series of core support for Unicode. We can use the functions in this package to accurately determine whether a character is a Chinese character.

Steam is a platform used by game enthusiasts. You can buy and purchase many games here. However, recently many users have been stuck in the mobile token verification interface when logging into Steam and cannot log in successfully. Faced with this Most users don't know how to solve this situation. It doesn't matter. Today's software tutorial is here to answer the questions for users. Friends in need can check out the operation methods. Steam mobile token error? Solution 1: For software problems, first find the steam software settings on the mobile phone, request assistance page, and confirm that the network using the device is running normally, click OK again, click Send SMS, you can receive the verification code on the mobile phone page, and you are done. Verify, resolve when processing a request
