$_POST['storageType'] = "file";
$_POST['scope'] = implode(",",$_POST['scope']);
$_POST['errorReport'] =false;
$setting = "<?php die('forbidden'); ?>n";
$setting .= json_encode($_POST);
$setting = str_replace("/", "/",$setting);
$incFile = fopen("../API/comm/inc.php","w+") or die("请设置APIcomminc.php的权限为777");
if(fwrite($incFile, $setting)){
echo "<meta charset='utf-8' />";
echo "配置成功,<a href='../example/'>查看example</a><br /><span style='color:red'>如果已配置成功并发布到外网,请只保留API目录下文件,删除intall目录下和其他文件</span>";
fclose($incFile);
}
思路就是:先把数组数据转换为json字符串,增加顶部代码die使得数据不被泄露。使用的时候这样取出来:
|