]; then modify the page, the code is [$old_inf = "/define\ ('$key','.*?'\);/";]."> How to modify the configuration file in php?-PHP Problem-php.cn

How to modify the configuration file in php?

coldplay.xixi
Release: 2023-03-01 14:38:01
Original
3171 people have browsed it

How to modify the configuration file in php?

How to modify the configuration file in php?

How to modify the configuration file in php:

1. Modify the boot page first

 

端口:
用户名:
密码:
数据库名:
Copy after login

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 "修改成功";
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!