SetBody($productname); $input->SetAttach($productname); $input->SetOut_trade_no($order_no); $input->SetTotal_fee($money * 100); $input->SetTime_start(date('YmdHis')); $input->SetTime_expire(date('YmdHis', time() + 600)); $input->SetGoods_tag('test'); $input->SetNotify_url($mymps_global['SiteUrl'] . '/include/payment/wxh5/notify.php'); $input->SetTrade_type('MWEB'); $order = WxPayApi::unifiedOrder($input); if ($order && $order['return_code'] == 'SUCCESS' && $order['result_code'] == 'SUCCESS') { $returnUrl = urlencode($mayimobile['mobiledomain'] . '/index.php?mod=member'); $goUrl = $order['mweb_url'] . '&redirect_url=' . $returnUrl; header("Location: {$goUrl} "); } else { echo ' 微信H5支付发起失败 ----'; echo $order['return_msg']; } function getOrderNo() { global $timestamp; return rand(11, 99) . $timestamp . rand(11, 99); }