【发布时间】:2016-04-20 17:37:17
【问题描述】:
我有 test.php,其中包含:
function tailShell($filepath, $lines = 1) {
ob_start();
passthru('tail -' . $lines . ' ' . escapeshellarg($filepath));
return trim(ob_get_clean());
}
$test = tailShell('som.log',3);
echo $test;
som.log 包含
1
2
3
4
5
6
当我使用它时,php 打印出类似 6 5 4 3 2 的文本,没有换行,如何解决这个问题?
【问题讨论】: