Rumah >pembangunan bahagian belakang >tutorial php >php 处理html时,字符串截断解决办法
php 处理html时,字符串截断
stream=fopen("xxx.html");<br />var str = '';<br />while(!feof(stream)<br />{<br /> size+=1024;<br /> str.=fread(stream,size);<br />}<br />....<br />
$stream=fopen("test.html","r");<br />$str = '';<br />$size=1024;<br />while(!feof($stream)){<br /> $tmp=fread($stream,$size);<br /> file_put_contents('d:/log.log',$tmp.PHP_EOL,FILE_APPEND);<br /> $str.=$tmp;<br /> $tmp='';<br />}<br />fclose($stream);<br />echo $str;