6.0 保存银联参数出错(Unable to open file)

努力尽今夕,少年犹可夸。这篇文章主要讲述6.0 保存银联参数出错:Unable to open file相关的知识,希望能为你提供帮助。



保存出错:Unable to open file!
6.0版本与5版的路径已经不同,这个原因就是路径造成的
路径:\\app\\system\\pay\\admin       admin_pay.class.php

/**
* 【银联】重写配置文件
*/
protected function CreatUnionPayConfig($unionpay_config)
global $_M;
$log_level = $unionpay_config[log_level] ? PhpLog::DEBUG : PhpLog::OFF;
//$file = PATH_WEB . $this-> ChangeStrType(app/system/web/pay/unionpay/SDKConfig.php);
$file = PATH_WEB . $this-> ChangeStrType(app/system/pay/web/unionpay/SDKConfig.php);
makefile($file);
$myfile = fopen($file, "w") or die("Unable to open file!");
$code = "< ?php\\n";
fwrite($myfile, $code);
$code = "const MERID_CONFIG = $unionpay_config[merid]; \\n";
fwrite($myfile, $code);
$code = "const SDK_SIGN_CERT_PWD = $unionpay_config[sign_cert_pwd]; \\n";
fwrite($myfile, $code);
$code = "const SDK_LOG_LEVEL = $log_level; \\n";
fwrite($myfile, $code);
$code = "const SDK_SIGN_CERT_PATH = " . str_replace("\\\\", "/", PATH_WEB) . str_replace("\\\\", "/", substr($unionpay_config[sign_cert_path], 3)) . "; \\n";
fwrite($myfile, $code);
$code = "const SDK_ENCRYPT_CERT_PATH = " . str_replace("\\\\", "/", PATH_WEB) . str_replace("\\\\", "/", substr($unionpay_config[encrypt_cert_path], 3)) . "; \\n";
fwrite($myfile, $code);
$code = "const SDK_VERIFY_CERT_DIR = " . str_replace("\\\\", "/", PATH_WEB) . "upload/file/; \\n";
fwrite($myfile, $code);
//$code = "const SDK_FILE_DOWN_PATH = " . str_replace("\\\\", "/", PATH_WEB) . "app/system/web/pay/unionpay/file/; \\n";
$code = "const SDK_FILE_DOWN_PATH = " . str_replace("\\\\", "/", PATH_WEB) . "app/system/pay/web/unionpay/file/; \\n";
fwrite($myfile, $code);
$code = "const SDK_LOG_FILE_PATH = " . str_replace("\\\\", "/", PATH_WEB) . "app/system/pay/web/unionpay/logs/; \\n";
//$code = "const SDK_LOG_FILE_PATH = " . str_replace("\\\\", "/", PATH_WEB) . "app/system/web/pay/unionpay/logs/; \\n";
fwrite($myfile, $code);
$code = "const SDK_FRONT_NOTIFY_URL = " . $_M[url][site] . "pay/return.php; \\n";
fwrite($myfile, $code);
$code = "const SDK_BACK_NOTIFY_URL = " . $_M[url][site] . "pay/notify.php; \\n";
fwrite($myfile, $code);
$code = "const SDK_FRONT_TRANS_URL = https://gateway.95516.com/gateway/api/frontTransReq.do; \\nconst SDK_BACK_TRANS_URL = https://gateway.95516.com/gateway/api/backTransReq.do; \\nconst SDK_BATCH_TRANS_URL = https://gateway.95516.com/gateway/api/batchTrans.do; \\nconst SDK_SINGLE_QUERY_URL = https://gateway.95516.com/gateway/api/queryTrans.do; \\nconst SDK_FILE_QUERY_URL = https://gateway.95516.com:9080/; \\nconst SDK_Card_Request_Url = https://gateway.95516.com/gateway/api/cardTransReq.do; \\nconst SDK_App_Request_Url = https://gateway.95516.com/gateway/api/appTransReq.do; \\nconst JF_SDK_FRONT_TRANS_URL = https://gateway.95516.com/jiaofei/api/frontTransReq.do; \\nconst JF_SDK_BACK_TRANS_URL = https://gateway.95516.com/jiaofei/api/backTransReq.do; \\nconst JF_SDK_SINGLE_QUERY_URL = https://gateway.95516.com/jiaofei/api/queryTrans.do; \\nconst JF_SDK_CARD_TRANS_URL = https://gateway.95516.com/jiaofei/api/cardTransReq.do; \\nconst JF_SDK_APP_TRANS_URL = https://gateway.95516.com/jiaofei/api/appTransReq.do; \\n";
fwrite($myfile, $code);
$code = "?> ";
fwrite($myfile, $code);
fclose($myfile);

app/system/web/pay/   改成




同时修改pay.class.php文件
路径:\\app\\system\\pay\\web

/**
* 重写web类的load_url_unique方法,获取前台特有URL
*/
protected function load_url_unique()
global $_M;
parent::load_url_unique();
$_M[url][own_func] = $_M[url][site].app/system/pay/web/include/function/;
$_M[url][own_class] = $_M[url][site].app/system/pay/web/include/class/;
//$_M[url][own_func] = $_M[url][site].app/system/web/pay/include/function/;
//$_M[url][own_class] = $_M[url][site].app/system/web/pay/include/class/;
$_M[url][pay_notify] = $_M[url][site].pay/notify.php;
$_M[url][pay_return] = $_M[url][site].pay/return.php;

$_M[url][tem] = $_M[url][site].app/system/pay/web/templates/met/;
//$_M[url][tem] = $_M[url][site].app/system/web/pay/templates/met/;
if($_M[lang] != $_M[config][met_index_type])
$lang = "?lang=$_M[lang]";

$lang = "?lang=$_M[lang]";
$_M[url][login] = $_M[url][site]."member/login.php$lang";
$_M[url][register] = $_M[url][site]."member/register_include.php$lang";
$_M[url][register_userok] = $_M[url][site]."member/register_include.php?lang=$_M[lang]& a=douserok";
$_M[url][getpassword] = $_M[url][site]."member/getpassword.php";
$_M[url][profile] = $_M[url][site]."member/basic.php$lang";
$_M[url][profile_safety] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dosafety";
$_M[url][pass_save] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dopasssave";
$_M[url][mailedit] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=doemailedit";
$_M[url][maileditok] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=doemailok";
$_M[url][profile_safety_emailadd] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dosafety_emailadd";
$_M[url][profile_safety_telok] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dosafety_telok";
$_M[url][profile_safety_telvalid] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dosafety_telvalid";
$_M[url][profile_safety_teladd] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dosafety_teladd";
$_M[url][profile_safety_teledit] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dosafety_teledit";
$_M[url][info_save] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=doinfosave";
$_M[url][valid_email_repeat] = $_M[url][site]."member/basic.php?lang=$_M[lang]& a=dovalid_email";
$_M[url][valid_email] = $_M[url][site]."member/register_include.php?lang=$_M[lang]& a=doemailvild";
$_M[url][valid_phone] = $_M[url][site]."member/register_include.php?lang=$_M[lang]& a=dophonecode";
$_M[url][login_check] = $_M[url][site]."member/login.php?lang=$_M[lang]& a=dologin";
$_M[url][register_save] = $_M[url][site]."member/register_include.php?lang=$_M[lang]& a=dosave";
$_M[url][password_email] = $_M[url][site]."member/getpassword.php?lang=$_M[lang]& a=doemail";
$_M[url][password_valid] = $_M[url][site]."member/getpassword.php?lang=$_M[lang]& a=dovalid";
$_M[url][password_telvalid] = $_M[url][site]."member/getpassword.php?lang=$_M[lang]& a=dotelvalid";
$_M[url][password_valid_phone] = $_M[url][site]."member/getpassword.php?lang=$_M[lang]& a=dophonecode";
$_M[url][login_out] = $_M[url][site]."member/login.php?lang=$_M[lang]& a=dologout";
$_M[url][login_other] = $_M[url][site]."member/login.php?lang=$_M[lang]& a=doother";
$_M[url][login_other_register] = $_M[url][site]."member/login.php?lang=$_M[lang]& a=dologin_other_register";
$_M[url][login_other_info] = $_M[url][site]."member/login.php?lang=$_M[lang]& a=dologin_other_info";

【6.0 保存银联参数出错(Unable to open file)】


    推荐阅读