search

Home  >  Q&A  >  body text

Why can't I generate a QR code?

class Index
{
public function index()
$input = new \WxPayUnifiedOrder();
// Set product description
$input->SetBody('Test product');
// Set order number
$input->SetOut_trade_no (date('YmdHis'));
//Set the order amount (unit: cents)
$input->SetTotal_fee('1');
//Set the asynchronous notification address
$ input->SetNotify_url('http://www.php.wx/index.php/index/Notify/index');
//Set transaction type
$input->SetTrade_type('NATIVE' );
// Set product ID
$input->SetProduct_id('123456780');
// Call unified order API
$result= \WxPayAPI::unifiedOrder($input) ;
               // Generate QR code
                $code_url = $result['code_url'];
      $img = '<img src=http://paysdk.weixin.qq.com/example/ qrcode.php?data='.urlencode($code_url).' />';
echo $img;

尾生尾生2173 days ago2331

reply all(1)I'll reply

  • 原始刻意

    原始刻意2020-05-23 16:32:47

    Is it ok?

    reply
    0
  • Cancelreply