1
之后没有匹配我试图对某些类型的URL使用preg_match
。如果/blog/
之后没有任何内容,我只想匹配,所以/blog/foo
应该不匹配。preg_match如果在/
preg_match("/^(http:\/\/)?([^\/]+)?(\/blog\/)/i", 'http://example.com/blog/', $matches)
我该如何才能让它只在/blog/
之后没有任何匹配?
这是有风险的,但“$”的伎俩!谢谢 – directory
@ user968898为什么风险很大? – FailedDev
,因为现在它可能会比http://做些什么welph等。 – directory