超过10条自动删除第一条。如何实现。
回复讨论(解决方案)
可以实现。首先读出文件里面的条数,及数据,放入到数组里面,接下来你知道再把你要的数据写进去,不就可以了呀。
$fn = '文本数据文件名';file_put_contents($fn, join('', array_slice(file($fn), -10)));
Statement: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