url='https://'.$_SERVER['HTTP_HOST']; $this->config=[ 'app_id'=>'2147483647', 'app_secret'=>'160130736b1ac0d54ed7abe51e44840b', 'api_url'=>'https://api.xunhupay.com/payment', ]; //构建测试数据 $orderID=time(); $this->data=[ 'version' => '1.1', 'appid' => $this->config['app_id'], 'trade_order_id'=> $orderID, //订单编号 'payment' => 'wechat', 'total_fee' => 0.1, 'title' => 'NO.'.$orderID, 'time' => time(), 'notify_url'=> '...', //异步回调地址 'return_url'=> '...', //支付成功跳转地址,可携带参数 'nonce_str' => md5(time()), 'plugins'=>'...' //备注字段 ]; } //微信扫码支付 public function wxNative(){ $Hupijiao=new Hupijiao($this->config); $data=$this->data; $data['payment']='wechat'; $data['notify_url']=$this->url.'/hupijiao-composer/demo.php'; $data['return_url']=$this->url.'/hupijiao-composer/demo.php?type=wx_native'; $response=$Hupijiao->request('wx_native',$data); ob_start(); ?>