Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我发现了一些可笑的长代码(大约 50 行长)用于使用 php 函数做这样的事情,我只是认为必须有更好的方法。
然后经过一番搜索,我发现了 unix 的“查找”和“尾”功能。
$lines = `find . -name "error_log" -exec tail '{}' +`;
但是我的服务器在 atm 下线,所以我无法对其进行测试,但这会起作用吗?
编辑:它按预期工作。
好的,我的服务器刚刚恢复正常,并且运行良好。不需要递归迭代器等等。