是的,它確實節省了內存和帶寬......我也跑了速度測試(這與這個問題並不完全密切相關,但是很有用,並且表明它確實停止讀取數據流)以及一個內存測試演示。我沒有運行峯值內存測試,但至少您的$ html變量將存儲更少的信息並在那裏節省內存。
Time to get ALL characters of remote page 10 times: 6.0368211269379
Time to get ALL characters of remote page 10 times: 6.0158920288086
Time to get ALL characters of remote page 10 times: 5.8945140838623
Time to get ALL characters of remote page 10 times: 8.867082118988
Time to get ALL characters of remote page 10 times: 5.7686760425568
Time to get first ten characters of page 10 times: 4.2118229866028
Time to get first ten characters of page 10 times: 4.5816869735718
Time to get first ten characters of page 10 times: 4.2146580219269
Time to get first ten characters of page 10 times: 4.1949119567871
Time to get first ten characters of page 10 times: 4.1788749694824
Memory Useage First 10 characters:40048
Memory Useage ALL characters:101064
不是一個答案,但你可能會發現這個有趣的:http://stackoverflow.com/questions/555523/file-get-contents-vs-curl-what-has-better - 性能 – 2012-01-03 15:09:35
謝謝,我認爲,說服我切換到捲曲 – 2012-01-03 22:17:06