0

在 Symfony 中,如何将当前的 URI slugs 作为数组获取?

www.mysite.com/this/that/test/hello/world/7?whatever=true

使用什么命令获取以下数组:

[0] => 'this',
[1] => 'that',
[2] => 'test',
[3] => 'hello',
[4] => 'world',
[5] => '7'
4

2 回答 2

2

尝试以下操作:

explode('/', $request->getPathInfo());

(我实际上不知道你会从哪里得到你的请求对象,所以你可能不得不重命名变量)

于 2012-09-05T15:05:26.503 回答
0

这应该有效:

 explode('/',$this->getContext()->getRouting()->getCurrentInternalUri());
于 2012-09-05T15:05:00.783 回答