<?php
$filename = '/data/webroot/usercode/resource/test.txt';
//编写代码读取$filename的文件内容
$content = file_get_contents('./test.txt');//"./test.txt"表示么意思?
echo 'this is a test file.';
$fp = fopen('./text.txt', 'rb');
while(!feof($fp))//"!feof()"表示么意思?
{
echo fgets($fp); //读取一行
}
fclose($fp);Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
$content = file_get_contents('./test.txt');//"./test.txt"表示么意思?-PHP中文网问答-$content = file_get_contents('./test.txt');//"./test.txt"表示么意思?-PHP中文网问答
围观一下哦,学习一下。
"./test.txt"指的是文件的路径,用来表示这个文件在哪,怎么找到。"!feof()"检测是否已到达文件末尾