if( $_POST )
{
$str = '23=12,34 78=1,3 45=12,46,78,89=33';
$content=nl2br($str);
$content=str_replace(" ","",$content);
$arr=explode("
",$content);
$result=array();
立即学习“PHP免费学习笔记(深入)”;
foreach ($arr as $value)
{
$k=explode("=",$value);
$result[]=array($k[0]=>$k[1]);
}
//数组转换成字串
function arrayeval($array, $level = 0) {
$space = '';
for($i = 0; $i
$space .= " ";
}
$evaluate = "Array $space( ";
$comma = $space;
foreach($array as $key => $val) {
$key = is_string($key) ? '''.addcslashes($key, ''\').''' : $key;
$val = !is_array($val) && (!preg_match("/^-?d+$/", $val) || strlen($val) > 12 || substr($val, 0, 1)=='0') ? '''.addcslashes($val, ''\').''' : $val;
if(is_array($val)) {
$evaluate .= "$comma$key => ".arrayeval($val, $level + 1);
} else {
$evaluate .= "$comma$key => $val";
}
$comma = ", $space";
}
$evaluate .= " $space)";
return $evaluate;
}
//把结果写到文件
$config=arrayeval($result);
$strwrite="";
$fp=fopen('config.php','w');
fwrite($fp,$strwrite);
fclose($fp);
}
?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号