首頁 >後端開發 >php教程 >哪位高手帮小弟我匹配下URL

哪位高手帮小弟我匹配下URL

WBOY
WBOY原創
2016-06-13 10:15:511061瀏覽

谁帮我匹配下URL
Mar 8 12:51:26 10.10.255.5 haproxy[4843]: 124.240.42.88:54351[10.10.255.5:36672]->121.14.0.101:80[121.14.0.101:80] [08/Mar/2012:12:51:26.627] http_check http_image/ 6/0/9/10/26 200 1520 - - ---- 500
/500/9/0/0 0/0 {news.sohu.com|http://wei.sohu.com/s2011/wei/?20120308} "GET /upload/sogou_world_20100618/h_bg_tag74on.gif HTTP/1.1"

------解决方案--------------------
$log = '
Mar 8 12:51:26 10.10.255.5 haproxy[4843]: 124.240.42.88:54351[10.10.255.5:36672]->121.14.0.101:80[121.14.0.101:80] [08/Mar/2012:12:51:26.627] http_check http_image/ 6/0/9/10/26 200 1520 - - ---- 500
/500/9/0/0 0/0 {news.sohu.com|http://wei.sohu.com/s2011/wei/?20120308} "GET /upload/sogou_world_20100618/h_bg_tag74on.gif HTTP/1.1"
';

preg_match('/http:\/\/(.*?)\s*}/s', $log, $m);
print_r($m[1]);

------解决方案--------------------
"#://([^/]+)#"

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn