Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of WeChat Pay php7.0 error

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly analyzes the relevant knowledge points of how to solve the problem of WeChat Pay php7.0 errors, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "how to solve WeChat Pay's php7.0 error problem".

WeChat Pay's solution to php7.0 error: 1. Check Wechat API;2 and use "php://inpu" instead of "$GLOBALS ['HTTP_RAW_POST_DATA']" to get data.

This article operating environment: Windows7 system, PHP7.0 version, DELL G3 computer

How to solve the problem of WeChat Pay php7.0 error?

PHP7 WeChat Pay callback failed to solve:

After upgrading PHP7, it was found that WeChat Pay callback failed. It turned out to be $GLOBALS ['HTTP_RAW_POST_DATA']; an undefined problem.

Php7 removes this global variable.

The problem code is as follows:

Wechat API: WxPay.Api.php

Public static function notify ($callback, & $msg) {/ / get notification data $xml = $GLOBALS ['HTTP_RAW_POST_DATA']; / / data cannot be obtained here under php7, use php://input instead of if (! $xml) {$xml = file_get_contents ("php://input") } / / verify the signature try {$result = WxPayResults::Init ($xml) if returned successfully;} catch (WxPayException $e) {$msg = $e-> errorMessage (); return false;} return call_user_func ($callback, $result) What language is php? php, a nested abbreviation, is the abbreviation of English Hypertext preprocessing language (PHP:Hypertext Preprocessor). PHP is a kind of HTML embedded language. PHP is somewhat similar to Microsoft's ASP. It is a scripting language that embeds HTML documents on the server. The style of the language is similar to C language, and now it is widely used by many website programmers.

This is the end of the introduction on "how to solve WeChat Pay's php7.0 error problem". More related content can be searched for previous articles, hoping to help you answer questions and questions, please support the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report