PHP切分nginx access log

* cut.php

 MAX_LINE-1) {		
		$line = 0;
		fclose($out);
		++$fileIndex;
		$out = fopen(sprintf(OUT_DIR."/%d.log", $fileIndex), "w");
	}
}
fclose($out);

* run:

php cut.php

-------------------------------------------------

php 数组转换URI

function build_query(/* array */$map) {
    $a = [];
    array_walk($map, function($value, $name) use (&$a) {
        $a[] = $name.'='.urlencode($value);
    });
    return implode('&', $a);
}

 

request URI  还原php数组

function decodeURI_PHP(s) {
	var sa = s.split('&').map(function(ss) {
		var pair = ss.split('=');
		return '  "' + pair[0]+'" => "'+decodeURIComponent(pair[1])+'",';
	}).join("\n");
	
	sa = sa.substr(0, sa.length-1);
	sa = "$a = [\n" + sa + "\n];";
	return sa;
}

var s = "APPVER=340901809&SESSIONID=d7b358ae-79cc-8687-8e5d-af2f3b255751&UID=czsh6&KEY=hpWjs5FgsxzAtlJjUh2b0A==&AT=1&CID=s197914&RID=467268&TIMESTAMP=8119181";

console.log(decodeURI_PHP(s));

$a = [
  "APPVER" => "340901809",
  "SESSIONID" => "d7b358ae-79cc-8687-8e5d-af2f3b255751",
  "UID" => "czsh6",
  "KEY" => "hpWjs5FgsxzAtlJjUh2b0A",
  "AT" => "1",
  "CID" => "s197914",
  "RID" => "467268",
  "TIMESTAMP" => "8119181"
];

eclipse pdt下载

wget http://mirror.bit.edu.cn/eclipse/technology/epp/downloads/release/2018-09/R/eclipse-php-2018-09-win32-x86_64.zip -O /home/ubuntu/Downloads/eclipse-php-2018-09-win32-x86_64.zip

 

你可能感兴趣的:(php,web,php,nginx,log,file)