纵有疾风起
人生不言弃

PHP文件读写

代码:

<?php
$handle  = @ fopen ( "demo.txt" ,  "r" );
if ( $handle ) {
	while (( $buffer  =  fgets ( $handle ,  4096 )) !==  false ) {
		echo  $buffer ;
	}
	if (! feof ( $handle )) {
		echo  "Error: unexpected fgets() fail\n" ;
	}
	fclose ( $handle );
}

echo '<hr/>';

$length= readfile("demo.txt");

echo '<hr/>';

$file_str = 'demo.txt';

if(file_exists($file_str))
{
	echo file_get_contents($file_str);
	
}

?>


PHP文件读写插图

效果:

PHP文件读写插图

PHP文件读写插图

PHP文件读写插图1

效果:

PHP文件读写插图2

原文链接:https://blog.csdn.net/w605283073/article/details/43423541

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

未经允许不得转载:起风网 » PHP文件读写
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录