Jos*_*ano 2 php parameters url param magento
在 Magento 中,我们通常用来获取参数
http://magento.com/customer/account/view/id/122
Run Code Online (Sandbox Code Playgroud)
我们可以通过
$x = $this->getRequest()->getParam('id');
echo $x; // value is 122
Run Code Online (Sandbox Code Playgroud)
现在据我所知 $x 只是为了从参数中获取一个字符串。
有没有办法将 $x 作为数组获取?
例如:
Array
(
[0] => 122
[1] => 233
)
Run Code Online (Sandbox Code Playgroud)
例如:
http://magento.com/customer/account/view/id/122-233
$x = $this->getRequest()->getParam('id');
$arrayQuery = array_map('intval', explode('-', $x)));
var_dump($arrayQuery);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11278 次 |
| 最近记录: |