Home>Article>Backend Development> PHP example tutorial: Automatically jump after successful payment via WeChat scan code on PC
This article mainly introduces in detail the code that automatically jumps to the PHP version after the WeChat scan code payment is successful. It has a certain reference value. Interested friends can refer to it.
The examples in this article are for everyone. Shared the specific code for php to automatically jump after successful WeChat scan code payment for your reference. The specific content is as follows
Scenario: PC side WeChat scan code payment
Result: Automatic jump after successful payment
Implementation idea:
On the payment QR code page, write ajax to request the payment status, request the result, and jump to the corresponding result page regardless of success or failure.
Specific implementation method:
html part:
Payment result status setting: 0 Unpaid 1 Payment successful 2 Payment failed
PHP part:
//支付状态检测 public function pay_status_check(){ $order_id = I("order_id"); $result = M('table')->where("order_id = $order_id")->find(); echo $result['pay_status']; }
These are the basic functions. If you want the effect to look better, you can add some styles, such as: If the payment is successful, a check mark animation will be added!
The above is the detailed content of PHP example tutorial: Automatically jump after successful payment via WeChat scan code on PC. For more information, please follow other related articles on the PHP Chinese website!