【www.gdgbn.com--文本特效】
//fopen 读取文件实例
代码如下$path ="a.txt";
$fp=fopen($file,"r");//以只读的方式打开文件
while(!(feof($fp)))
{
$text=fgets($fp);//读取文件的一行
echo $text;
}
//file_get_contents读取文件
代码如下if( file_exists( $path ) )
{
$body = file_get_contents($path);
echo $body ;//输入文件内容
}
else
{
echo "文件不存在 $path";
}
//file
读取文本文件
代码如下 $cbody = file($path);
print_r($cbody); //因为file读取出来的文件是以数组形式保存的,所以用print_r输出。