如何从控制器中的URL访问参数值?

时间:2016-12-09 20:19:09

标签: php phalcon url-parameters

我需要一些关于phalcon框架中参数传递的信息

示例网址:http://localhost/project/vehicle/new/vinno/1323123

vehicleController{
    newAction {
        //get the value of vinno

        // want to send parameter to view
    }
}

2 个答案:

答案 0 :(得分:2)

尝试转储调度程序参数。

print_r($this->dispatcher->getParams());

以上将根据您的路由器定义为您提供完整的参数数组。有关调度程序的更多信息,请参阅 the docs

要获取特定参数值,您可以使用getParam()方法。

print_r($this->dispatcher->getParam('your_param_name'));

答案 1 :(得分:2)

使用路线参数。并使用$this->view->setVar

相关问题