Symfony implements the behavior and method of obtaining the request parameter in the template, Symfonyrequest
The examples in this paper describe the Symfony implementation behavior and the method of obtaining request parameters in the template. Share to everyone for your reference, as follows:
I. Getting parameters in a template
<?php echo $sf _request->getparameter (' name ', ' namespace ');? ><?php echo $sf _request->getparameter (' name ');? >
Two. Parameters obtained in behavior
$request->getparameter (' name ');//Template Get Parameters <?php echo $sf _params->get (' name ')? >//with default values <?php echo $SF _params->get (' name ', ' Default ')? >//in the template to determine whether a parameter exists <?php if ($sf _params->has (' name ')):?>hello,<?php echo $sf _params->get (' name ')? >!
<?php Else:?>hello,johndoe!
<?php endif; >//contains an array of all parameters $request->getparameterholder ()->getall ()//full URI path//' http://localhost/ Myapp_dev.php/mymodule/myaction ' GetURI ()//'/mymodule/myaction ' getpathinfo ()//in action $hasfoo = $this Getrequest ()->hasparameter (' foo '); $hasFoo = $this->hasrequestparameter (' foo ');//shorter version$foo =$ This->getrequest ()->getparameter (' foo '); $foo = $this->getrequestparameter (' foo ');//shorterversion
It is hoped that this article is helpful to the PHP program design based on Symfony framework.
Articles you may be interested in:
- Symfony2 study notes of the controller usage detailed
- An example analysis of controller usage of SYMFONY2 development
- Symfony Core class overview
- Ways to create a project using the Symfony command
- Examples of shortcut variable usages for symfony templates
- Symfony2 framework Create project and template Setup examples
- Analysis of plugin format of Symfony2 learning notes
- Symfony2 Study Notes System routing
- Symfony2 Study Notes Template usage detailed
- How to install and configure Symfony
- Symfony control layer in-depth explanation
http://www.bkjia.com/PHPjc/1111329.html www.bkjia.com true http://www.bkjia.com/PHPjc/1111329.html techarticle Symfony implements the behavior and method of obtaining the request parameter in the template, Symfonyrequest This example describes the Symfony implementation behavior and the method of obtaining the request parameter in the template. Share to everyone ...