日期:2014-05-17 浏览次数:20706 次
log_format main '$server_name$remote_addr$remote_user[$time_local]"$request"'
'$status$body_bytes_sent"$http_referer"'
'"$http_user_agent""$http_x_forwarded_for"';
server_name : 虚拟主机的主机名称 remote_addr : 远程客户端的ip地址 remote_user : 远程客户端用户名称 time_local : 访问的时间与时区 status : 记录请求返回的http状态码 body_bytes_sent : 发送给客户端的文件主体内容的大小 http_referer : 从哪个页面链接访问过来 http_user_agent : 客户端浏览器信息 http_x_forwarded_for : 客户端的真实ip
/**
* Description:按行读取文件内容进行过滤匹配
*
* @return array
*/
function readFileContent ($filename)
{
$weibo_content = array();
$fh = @fopen($filename, 'r');
if ($fh) {
while (! feof($fh)) {
$row = fgets($fh, 4096);
$row_arr = explode("", $row);
if (isset($row_arr[3]) && preg_match('/weibo/', $row_arr[3])) {
$weibo_content[] = $row_arr;
}
}
}
fclose($fh);
return $weibo_content;
}