setConfig(3); var_dump($data); } public function testPay() { $data = \app\main\service\WxH5PayService::instance()->getPayUrl(39, 'wechath5'); var_dump($data); } protected $config = [ 'app_id' => 'wxf22a1e822520431b', // 公众号 APPID 'mch_id' => '1530454551', 'key' => '0924813sdfEFADVTwdYadsfoas83138F', 'notify_url' => 'https://zsjwsfz.wnread.cn/clientappapi/wxpay/nofitycallback', 'http' => [ // optional 'timeout' => 5.0, 'connect_timeout' => 5.0, // 更多配置项请参考 [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html) ], ]; public function testH5() { $order = [ 'out_trade_no' => time(), 'total_fee' => '1', 'body' => 'test body - 测试', ]; $data = Pay::wechat($this->config)->wap($order); var_dump($this->config);exit; $target = $data->getTargetUrl(); $client = new \GuzzleHttp\Client([ 'connect_timeout' => 3, 'timeout' => 3, 'http_errors' => true, //抛出异常 true是 false否 'verify' => false, //不验证ssl证书 'headers' => ['Referer' => 'http://payh5.dev.kpread.com/', 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'], ]); $result = $client->get($target); var_dump($result->getBody()->getContents()); preg_match('/deeplink : "(weixin:\/\/wap\/pay\?.*?)"/', $result->getBody(), $match); var_dump($match[1]); } }