-
Notifications
You must be signed in to change notification settings - Fork 18
/
fenx.php
115 lines (104 loc) · 3.42 KB
/
fenx.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
require_once "WxPay/WxPay.JsApiPay.php";
require_once "WxPay/JsSdk/jssdk.php";
$jssdk = new JSSDK("wxf11f2ddbbad15ac4", "8e73b95838eb36e6d86b1aaa2c9fe0f3");
$signPackage = $jssdk->GetSignPackage();
$openId = 'oH0suwGYLc22iniWUCf7S2H_Q_2c';
$openId2 = 'oH0suwGYLc22iniWUCf7S2H_Q_2c';
$tools = new JsApiPay();
$openId2 = $tools->GetOpenid();
function getHttpContent($url, $method = 'POST', $postData = array())
{
$data = '';
if (!empty($url)) {
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //30秒超时
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
if (strtoupper($method) == 'POST') {
$curlPost = is_array($postData) ? http_build_query($postData) : $postData;
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
}
$data = curl_exec($ch);
curl_close($ch);
} catch (Exception $e) {
$data = null;
}
}
return $data;
}
$url = '***';
$jsApiParameters = getHttpContent($url);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="/lightTime_resource/dist/libs/flexible.js"></script>
<script src="/lightTime_resource/dist/libs/weixin.js"></script>
<script>
wx.config({ //配置jssdk
debug: false,
appId: '<?php echo $signPackage["appId"];?>',
timestamp: <?php echo $signPackage["timestamp"];?>,
nonceStr: '<?php echo $signPackage["nonceStr"];?>',
signature: '<?php echo $signPackage["signature"];?>',
jsApiList: [
"chooseImage",
"previewImage",
"uploadImage",
"downloadImage"
]
});
</script>
<script type="text/javascript">
//调用微信JS api 支付
function jsApiCall(param)
{
alert(JSON.stringify(param));
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
param,
function(res){
WeixinJSBridge.log(res.err_msg);
alert(res.err_code+res.err_desc+res.err_msg);
}
);
}
function callpay(param)
{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
}else{
jsApiCall(param);
}
}
</script>
<script type="text/javascript">
const openid = "<?php echo $openId.'a'; ?>";
const openid2 = "<?php echo $openId2.'a'; ?>";
alert(openid);
alert(openid2);
</script>
<title></title>
</head>
<body>
<div id="light_time">
<loadpart v-show="showLoading"></loadpart>
<router-view></router-view>
</div>
<script src="/lightTime_resource/dist/libs/vue.min.js"></script>
<script src="/lightTime_resource/dist/js/common.js"></script>
<script src="/lightTime_resource/dist/js/build.js"></script>
</body>
</html>