Symfony implementing the behavior and methods of obtaining the request parameters in the template, symfonyrequest_php tutorial

Source: Internet
Author: User

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.