stream=fopen("xxx.html");var str = '';while(!feof(stream){ size+=1024; str.=fread(stream,size);}....
$stream=fopen("test.txt","a+");$str = '';$size=1024;while(!feof($stream)){ $str.=fread($stream,$size);}fclose($stream);echo $str;
$stream=fopen("test.txt","a+");$str = '';$size=1024;while(!feof($stream)){ $str.=fread($stream,$size);}fclose($stream);echo $str; 就你上面的代码而言,都不能运行,可能是你写错吧
至于你说的html的某个特殊字符,应该是不存在的
而且你只是读取一个html,数据不大,建议用file_get_contents(),性能比fread好
你那又不是 php 代码
就你上面的代码而言,都不能运行,可能是你写错吧
至于你说的html的某个特殊字符,应该是不存在的
而且你只是读取一个html,数据不大,建议用file_get_contents(),性能比fread好
你用
$stream=fopen("test.html","r");$str = '';$size=1024;while(!feof($stream)){ $tmp=fread($stream,$size); file_put_contents('d:/log.log',$tmp.PHP_EOL,FILE_APPEND); $str.=$tmp; $tmp='';}fclose($stream);echo $str;您那是什么代码?C么?
你用
$stream=fopen("test.html","r");$str = '';$size=1024;while(!feof($stream)){ $tmp=fread($stream,$size); file_put_contents('d:/log.log',$tmp.PHP_EOL,FILE_APPEND); $str.=$tmp; $tmp='';}fclose($stream);echo $str;
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号