阅读背景:

php读取LOG文件前N行。根据文件关键字,读取文件夹下最新的文件_weixin_34232363的博客

来源:互联网 
if($id == 3){
    $name="/tmp/youtube_upload.log";
    $file = escapeshellarg($name);
    $info = `tail -n 500 $file`;
}else if($id == 1){
    chdir(LOGFILE);
    $name=`ls -t |grep 'success_' | head -n1`;
    $path=str_replace(PHP_EOL, '', $name);
    $path=LOGFILE.$path;
    $info="logファイル名:$path\n".file_get_contents($path);
}else if($id == 2){
    chdir(LOGFILE);
    $name=`ls -t |grep 'failure_' | head -n1`;
    $path=str_replace(PHP_EOL, '', $name);
    $path=LOGFILE.$path;
    $info="logファイル名:$path\n".file_get_contents($path);

}
if($id 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: