如果不懂怎么配置的話請看文章 php 微信開發之 微信支付配置 基本配置后在繼續本文章的開發 。 本文章就先繼續基本的實現!也並不困難。我大概的思路的返回購買者的唯一id 和 訂單號的唯一 id 就2個參數而已
1.解壓壓縮包后里面有一個 example 的文件夾內有一個 jsapi.php
修改代碼 $input->SetNotify_url("http://你的域名/example/notify.php");
2. 修改文件 example/WxPay.JsApiPay.php
位於 99 行
curl_setopt($ch, CURLOP_TIMEOUT, $this->curl_timeout);
修改為:
curl_setopt($ch, CURLOPT_TIMEOUT,60); //為等待時間 甚至為 60 就是響應最遲是 60秒
解決了 微信支付Notice: Use of undefined constant CURLOP_TIMEOUT - assumed 'CURLOP_TIMEOUT 報錯
然后就到這里了~ 因為覺得微信v3 更新后 使用教程並沒有 v2的來得多 所以決定采用了 微信v2 的支付sdk 來開發
轉載:http://alzhai.com/post-698.html
微信支付示例接口一打開就報了這樣的錯誤
Notice: Use of undefined constant CURLOP_TIMEOUT - assumed 'CURLOP_TIMEOUT' in /wx_pay_test/WxPayPubHelper/WxPayPubHelper.php on line 155
Warning: curl_setopt() expects parameter 2 to be long, string given in wx_pay_test/WxPayPubHelper/WxPayPubHelper.php on line 155
一下就懵了,仔細打開源碼一看,文件中在155行這里設置超時的時候,本來應該是
curl_setopt($ch, CURLOPT_TIMEOUT, $second);
可是接口中的文件卻是這樣的
curl_setopt($ch, CURLOP_TIMEOUT, $second);
哈哈,設置參數的字母寫錯了,修改這里,兩條報錯消失。
轉載:http://blog.dxjsw.com/archives/107.html