本文整理匯總了PHP中Parseline函數的典型用法代碼示例。如果您正苦於以下問題:PHP Parseline函數的具體用法?PHP Parseline怎麽用?PHP Parseline使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Parseline函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unix
$GLOBALS["PDNS_HACK_DB"]=array();
$unix=new unix();
$GLOBALS["NODRYREBOOT"]=$sock->GET_INFO("NoDryReboot");
$GLOBALS["CLASS_SOCKET"]=$sock;
$GLOBALS["CLASS_UNIX"]=$unix;
$sock=null;
$unix=null;
$mem=round(((memory_get_usage()/1024)/1000),2);events("{$mem}MB before forking","MAIN",__LINE__);
$_GET["server"]=$users->hostname;
$pipe = fopen("php://stdin", "r");
while(!feof($pipe)){
$buffer .= fgets($pipe, 4096);
try{ Parseline($buffer);}catch (Exception $e) {events("fatal error:". $e->getMessage());}
$buffer=null;
}
fclose($pipe);
events("Shutdown...");
die();
function Parseline($buffer){
$buffer=trim($buffer);
if(preg_match("#artica-filter#",$buffer)){return true;}
if(preg_match("#postfix\/#",$buffer)){return true;}
if(preg_match("#CRON\[#",$buffer)){return true;}
if(preg_match("#: CACHEMGR:#",$buffer)){return true;}
if(preg_match("#exec\.postfix-logger\.php:#",$buffer)){return true;}
if(preg_match("#artica-install\[#",$buffer)){return true;}
示例2: die
if (posix_getuid() != 0) {
die("Cannot be used in web server mode\n\n");
}
if (!Build_pid_func(__FILE__, "MAIN")) {
events("Already executed.. aborting the process");
die;
}
$pid = getmypid();
$pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid";
@mkdir("/home/apache/artica-stats", 0666, true);
events("running {$pid} ");
file_put_contents($pidfile, $pid);
$pipe = fopen("php://stdin", "r");
while (!feof($pipe)) {
$buffer .= fgets($pipe, 4096);
Parseline(trim($buffer));
$buffer = null;
}
fclose($pipe);
DumpMemory();
events("Shutdown...");
die;
function Parseline($buffer)
{
if ($buffer == null) {
return;
}
$FOUND = false;
if (preg_match('#ngx\\[(.*?)\\]\\s+(.+?)\\s+(.+?)\\s+(.*?)\\s+\\[(.+?)\\]\\s+([A-Z]+)\\s+(.+?)\\s+[A-Z]+\\/[0-9\\.]+\\s+"([0-9]+)"\\s+([0-9]+)#', $buffer, $re)) {
$FOUND = true;
$hostname = $re[1];