Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 magento 中为 get 方法的参数设置默认值?
$page_num=($this->getRequest()->getParam('page')) ?$this->getRequest()->getParam('page'):0;
尝试:
$page_num = $this->getRequest()->getParam('page', 0); // 0 - default value
第二个参数是默认返回值,可以是你喜欢的任何值。