1

如何使用 PHP 从 http.conf 检索变量,例如别名 /MyDirectory/ "C:/MyDirectory/MyDirectory/"。有没有比打开 http.conf 并逐行阅读更简单的方法?

谢谢

4

1 回答 1

0

您总是可以使用fgets()从文件中读取单行。但是你为什么要从你的程序中修改你的服务器设置呢?

$handle = fopen('httpd.conf', 'r');
if($handle) {
    while($buffer = fgets($handle) !== false) {
        // do something with the data you read
    }
    if (!feof($handle)) {
        echo 'An error occured';
    }
    fclose($handle);
}
于 2012-10-16T06:42:13.757 回答