微信浏览器中如何使用支付宝支付

php

浏览数:465

2019-1-7


如何在微信浏览器拦截支付宝时候,开发一个可以在微信商城里面使用支付宝支付

php代码:

if ( strpos($_SERVER['HTTP_USER_AGENT'],'MicroMessenger') !== false ){
    $alipaySubmit = new AlipaySubmit($alipay_config);
    $html_text = $alipaySubmit->getHtml($parameter);
//  $content = '<iframe src="'.$html_text.'" name="iframepage" id="iframepage"  scrolling="no" frameborder="0"></iframe>';
    include ('alipaywx.html');
}else{
    //不是微信浏览器
    $alipaySubmit = new AlipaySubmit($alipay_config);
    $html_text = $alipaySubmit->buildRequestForm($parameter,"get", "确认");
    echo $html_text;exit;
}alipaywx.html代码:

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>支付宝支付</title>
</head>
<body style="background: #1d93ca">
<center>
    <br class="scroll-wrapper" style="margin: 0 auto">
    <?php if ( strpos($_SERVER['HTTP_USER_AGENT'],'MicroMessenger') !== false ){?>
    <h3>/(ㄒoㄒ)/~~亲,</h3>
    <h4>由于微信会自动屏蔽支付宝支付,请点击右上角以浏览器打开进行支付</h4>
    <?php }else{?>
    <h2>erdangjiade</h2>
    <br><a href="<?php echo $html_text;?>" class="btn btn-success">支付宝支付</a></br>
    <?php }?>
    </div>
</center>
</body>
</html>