/**
* 配置账号信息
* 由于 配置信息都设置成了常量,无法用变量动态获取配置信息
* 所以这里将整个类放到了变量中,然后动态获取配置信息
*/
require_once("././././config.php");
require_once(SYSTEM."db.php"); //导入db类
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);//实例化db
$sql = "SELECT * FROM setting ";
$query = $db->query($sql);
$rows = $query->rows;
$appid = '5';
$mchid = '1';
$key = 'a';
$appsecret = 'c';
$sslcert_path = 'apiclient_cert.pem';
$sslkey_path = 'apiclient_key.pem';
$curl_proxy_host = '0.0.0.0';
$curl_proxy_port = 0;
$report_levenl = 1;
if($rows){
foreach($rows as $k=>$row){
$$row['key'] = $row['value'];
}
}
$config = "
class WxPayConfig
{
const APPID = '$appid';
const MCHID = '$mchid';
const KEY = '$key';
const APPSECRET = '$appsecret';
const SSLCERT_PATH = '$sslcert_path';
const SSLKEY_PATH = '$sslkey_path';
const CURL_PROXY_HOST = '$curl_proxy_host';//'10.152.18.220';
const CURL_PROXY_PORT = $curl_proxy_port;//8080;
const REPORT_LEVENL = $report_levenl;
}
";
eval($config);
unset($config, $appid, $mchid, $key, $appsecret, $sslcert_path, $sslkey_path, $curl_proxy_host, $curl_proxy_port, $report_levenl);
//echo WxPayConfig::APPID;exit;