开发者

get specific value from file_get_content

开发者 https://www.devze.com 2023-01-16 21:12 出处:网络
hi i need to get specific content from th开发者_JAVA技巧e file get content but the problem is if i made a function which determine the content of a page and when i call this function in a loop (means

hi i need to get specific content from th开发者_JAVA技巧e file get content but the problem is if i made a function which determine the content of a page and when i call this function in a loop (means more than 200 times) than memory limit problem occur . i have resolve this problem by increase the memory limit by ini_set . My Question is that how can i increase the performance of this function.should i use ob_flush after reading the content or there is another way .please let me know . thnks


file_get_contents() reads the entire file into memory, which could be a problem when working on large files.

You could consider using the fopen() family of functions, which are more memory friendly.


After getting contents of the site using file_get_contents() use mb_split() function to get the contents of the file as an array of words.

0

精彩评论

暂无评论...
验证码 换一张
取 消