]; then modify the page, the code is [$old_inf = "/define\ ('$key','.*?'\);/";].">
How to modify the configuration file in php?
How to modify the configuration file in php:
1. Modify the boot page first
2. Modify the page
$value) { //正则匹配对应的一行 $old_inf = "/define\('$key','.*?'\);/"; //要修改成的数据 $new_inf = "define('$key','$value');"; //替换 $string = preg_replace($old_inf,$new_inf,$string); } //写入配置文件 file_put_contents('config.php',$string); echo "修改成功";
Recommended tutorial: "PHP Video Tutorial"
The above is the detailed content of How to modify the configuration file in php?. For more information, please follow other related articles on the PHP Chinese website!