fgets慢,有没有其它办法解决办法

WBOY
Release: 2016-06-13 12:43:41
Original
1171 people have browsed it

fgets慢,有没有其它办法
方法:

$fp = fsockopen($server, $port, $errno, $errstr ,30);<br />
fputs($fp, $send_all);<br />
stream_set_timeout($fp, 30);<br />
$result = '';<br />
while(!feof($fp)) {<br />
   $result.= fgets($fp,1024);<br />
}<br />
print_r($result);
Copy after login


这样虽然能取到数据,可太慢了,得二十多秒。

有其它方法能读到数据吗?不要用fread,用fread取不到完整数据。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template