0

我在安装网站时遇到问题。我想进行网站安装,但我需要将其插入到我的 config.php 文件中的表单。

这是 config.php 文件代码:

$conf = $TMPL = array(); 
$conf['host'] = '';
$conf['user'] = '';
$conf['pass'] = '';
$conf['name'] = '';
$conf['url'] = ''; 
$conf['mail'] = '';

我需要将示例“localhost”插入的表格$conf['host'] = 'localhost';

4

1 回答 1

0
<form action="" method="POST">
<input type="text" name="host">
<input type="text" name="user">
<input type="text" name="pass">
<input type="text" name="name">
<input type="text" name="url">
<input type="text" name="mail">
<input type="submit" name="submit">
</form>

<?php

if(isset($_POST['submit'])) {
 $host = $_POST['host'];
 $user = $_POST['user'];
 $pass = $_POST['pass'];
 $name = $_POST['name'];
 $url = $_POST['url'];
 $mail = $_POST['mail'];

 $configfile = "config.php";

 file_put_contents($configfile, "<?php 
\$conf = array();  \$conf['host'] = '". $host ."'; \$conf['user'] = '". $user ."'; \$conf['pass'] = '". $pass ."'; \$conf['name'] = '". $name ."'; \$conf['url'] = '". $url ."'; \$conf['mail'] = '". $mail ."';; ");
}
于 2013-08-30T23:02:19.953 回答