请各位大虾指点,系统安装后,配置文件config会自动生成,其中包括数据库配置等,请问是怎样生成的呢?

解决方案 »

  1.   

    file_put_contents("config.php", '<?php echo "HELLO WORLD!";?>');//数据随你组装
    //数据库配置信息,都是你自己填写的
      

  2.   

    同楼上$host = $_POST['host'];
    //……省略,获取信息
    //定义要写入的字符串,类似
    //<?php
    //$host = "location";
    //$hostuser = "root";    ............
    //?>
    $writestring = "<?php\n\r$host=\"".$host."\";\n\r……省略?>";
    //写入config.php文档
    file_put_contents("config.php",$writestring);