linux下PHP写入和读取单个文件建议不超过多大?

WBOY
Release: 2016-06-06 20:27:46
Original
1187 people have browsed it

linux下PHP写入和读取单个文件建议不超过多大?

回复内容:

linux下PHP写入和读取单个文件建议不超过多大?

这个没有固定答案.
比如你要经常读取文件(大小均可),放在/dev/shm/下,这个将文件直接放在了内存,速度很可观.
PHP读取大文件的话,我想到几种方法
1.file_get_contents 不能用,直接将文件内容放入一个字符串,而且一般php.ini里面有限制当前进程占用内存大小.
2.按行读取
3.指针.PHP是用C语言实现的,fseek(),给一个当前文件的偏移量(byte),直接跳过了前面,而且可以设置从文件结尾后往前的偏移
4.Linux命令行

Related labels:
php
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