微信支付配置文件WxPay.Config.php如何读取数据库配置信息
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;
$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_r($config);
unset($config, $appid, $mchid, $key, $appsecret, $sslcert_path, $sslkey_path, $curl_proxy_host, $curl_proxy_port, $report_levenl);
//echo WxPayConfig::APPID;exit;
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;
$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_r($config);
unset($config, $appid, $mchid, $key, $appsecret, $sslcert_path, $sslkey_path, $curl_proxy_host, $curl_proxy_port, $report_levenl);
//echo WxPayConfig::APPID;exit;