当前位置:Gxlcms > PHP教程 > 哪位高手帮小弟我匹配下URL

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

时间:2021-07-01 10:21:17 帮助过:12人阅读

谁帮我匹配下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]);

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

人气教程排行