-
Notifications
You must be signed in to change notification settings - Fork 23
/
config.php
executable file
·72 lines (60 loc) · 2.22 KB
/
config.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
<?php
/*
* @Author: yumusb
* @Date: 2019-08-19 17:35:15
* @LastEditors: yumusb
* @LastEditTime: 2019-08-19 17:50:00
* @Description:
*/
header("Content-type: text/html; charset=utf-8");
function exitt($a = "错误", $b = "../")
{
echo "<script>alert('{$a}');window.location.href='{$b}'</script>";
exit();
}
const NeedTakeNote = 'yes';
//需要记录,则改为 yes
//不需要 值为 no
//如果需要记录 需要正确的数据库配置
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$url = dirname($http_type . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]) . "/notify.php";
$url = ''; //支付宝后台的回调通知地址
//echo "{$url}?check"; //访问这个输出的url检测回调可用性
$alipay_config = array(
//签名方式,默认为RSA2(RSA2048)
'sign_type' => "RSA2",
//支付宝公钥
'alipay_public_key' => "",
//商户私钥
'merchant_private_key' => "",
//编码格式
'charset' => "UTF-8",
//支付宝网关
'gatewayUrl' => "https://openapi.alipay.com/gateway.do",
//应用ID
'app_id' => "", //
//最大查询重试次数
'MaxQueryRetry' => "10",
'notify_url' => $url,
//查询间隔
'QueryDuration' => "3"
);
if ($alipay_config['alipay_public_key'] == '' || $alipay_config['merchant_private_key'] == '' || $alipay_config['app_id'] == '') {
exit("alipay_public_key/merchant_private_key/app_id must not be null");
}
//数据库配置信息。
if (NeedTakeNote == "yes") {
$database = array(
'dbname' => '', //修改这个,数据库名
'host' => '',
'port' => 3306,
'user' => '', //修改这个,数据库用户名
'pass' => '', //修改这个,数据库密码
);
try {
$db = new PDO("mysql:dbname=" . $database['dbname'] . ";host=" . $database['host'] . ";" . "port=" . $database['port'] . ";", $database['user'], $database['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
} catch (PDOException $e) {
die("数据库出错,请检查 config.php中的database配置项.<br> " . $e->getMessage() . "<br/>");
}
$table = 'f2f_order'; //表名字
}