php - 解析友好的 url
我有这样的 url,
/cp/foo-bar/another-testing
如何使用模式
/cp/{0}-{1}/{2}
结果解析它,
0:foo
1:bar
2:another-testing
我需要一个全局解决方案来解析具有这样的模式的所有类型的 url。我的意思是使用 {0}, {1} 标志。
I have url like this
/cp/foo-bar/another-testing
how to parse it with the pattern
/cp/{0}-{1}/{2}
results will be
0:foo
1:bar
2:another-testing
I need a global solution to parse all kind of url with a pattern like that. I mean using {0}, {1} flag.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我提供了一种新方法,而不是使用
{0}
、{1}
、{2}
:使用{$s[ 0]}
、{$s[1]}
、{$s[2]}
:Instead of using
{0}
,{1}
,{2}
, I offer a new way: using{$s[0]}
,{$s[1]}
,{$s[2]}
: