//time_stamp已填,商户无需重复填写 //sign已填,商户无需重复填写 $product_id = WxPayConf_pub::APPID . "static"; //自定义商品id $nativeLink->setParameter("product_id", "{$product_id}"); //商品id //获取链接 $product_url = $nativeLink->getUrl(); //使用短链接转换接口 $shortUrl = new ShortUrl_pub(); //设置必填参数 //appid已填,商户无需重复填写 //mch_id已填,商户无需重复填写 //noncestr已填,商户无需重复填写 //sign已填,商户无需重复填写 $shortUrl->setParameter("long_url", "{$product_url}"); //URL链接 //获取短链接 $codeUrl = $shortUrl->getShortUrl(); ?> <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>微信安全支付</title> </head> <body> <div align="center" id="qrcode"> <p >扫我,扫我</p> </div>
/** * 静态支付 * return $product_url 二维码链接 */ function NativeStaticInterface() { $nativeLink = new NativeLink_pub(); $nativeLink->setParameter("product_id", WxPayConf_pub::APPID . "static"); //商品id //获取链接 $product_url = $nativeLink->getUrl(); $shortUrl = new ShortUrl_pub(); $shortUrl->setParameter("long_url", "{$product_url}"); //URL链接 $codeUrl = $shortUrl->getShortUrl(); return $product_url; }
public function native_pay() { //全局引入微信支付类 Vendor('Wxpay.WxPayPubHelper.WxPayPubHelper'); //设置静态链接 $nativeLink = new \NativeLink_pub(); //设置静态链接参数 //设置必填参数 //appid已填,商户无需重复填写 //mch_id已填,商户无需重复填写 //noncestr已填,商户无需重复填写 //time_stamp已填,商户无需重复填写 //sign已填,商户无需重复填写 $product_id = \WxPayConf_pub::APPID . "static"; //自定义商品id $nativeLink->setParameter("product_id", $product_id); //商品id //获取链接 $product_url = $nativeLink->getUrl(); //使用短链接转换接口 $shortUrl = new \ShortUrl_pub(); //设置必填参数 //appid已填,商户无需重复填写 //mch_id已填,商户无需重复填写 //noncestr已填,商户无需重复填写 //sign已填,商户无需重复填写 $shortUrl->setParameter("long_url", $product_url); //URL链接 //获取短链接 $codeUrl = $shortUrl->getShortUrl(); $this->assign('product_url', $product_url); $this->assign('codeUrl', $codeUrl); $this->display(); }