Home > Article > Backend Development > Ask about WeChat scan code payment problem
Why do I keep getting this error? I don’t know how to solve it. Does anyone know? What I do is scan code payment mode 2
Why do I keep getting this error? I don’t know how to solve it. Does anyone know? What I do is scan code payment mode 2
Try to output: $result and see, it is definitely not defined in the code_url key.
The code_url does not exist in the returned result, indicating that there is an error in communicating with WeChat. The correct approach is to first determine whether the result is successful, and then get the code_url. The sample code is as follows:
<code>if($result["result_code"] == "FAIL") { //失败 echo "错误代码:".$result['err_code']."<br>"; echo "错误代码描述:".$result['err_code_des']."<br>"; exit; }elseif($result["code_url"] != NULL) { //成功 //获取code_url } </code>
After reading your 37 lines of code, I think you should know how to debug. Did you not understand the English semantics of error reporting? Otherwise, just comment out the 37 lines of code and see the print result
$url2 = isset($result['code_url ']) ? $result['code_url '] : '';
I want to add a sentence
<code class="php">$input->SetSpbill_create_ip(你的服务器IP);</code>