文件操作


配置文件


范例

[运行代码]

$filename = __DIR__ . '/test.txt';
$data = <<<EOF
one
two
three
four
five
six

EOF;
$result = file_put_contents($filename, $data);

echo "<pre>";
$fh = fopen($filename, 'r');
while(feof($fh) == false){
    $line = trim(fgets($fh));
    if(!isset($line[0])){
        continue;
    }
    echo $line, "\n";
}

[执行结果]

one
two
three
four
five
six

相关函数

参考资料

http://w3school.com.cn/php/php_file.asp