Quick variable usage of the Symfony template _ php instance

Source: Internet
Author: User
This article mainly introduces the quick variable usage of the Symfony template, and analyzes three common methods for calling quick variables of the Symfony template in the form of simple examples, for more information about the quick variable usage of the Symfony template, see the examples in this article. We will share this with you for your reference. The details are as follows:

Some symfony variables can be directly used in the template. Using these shortcut variables, you can obtain some of the most common template information from the symfony object:

$ Sf_context: complete environment object (sfContext class instance)
$ Sf_request: request object (sfRequest class instance)
$ Sf_params: Request Parameter
$ Sf_user: current user session object (sfUser class instance)

Three common usage methods:

// 1. Long version <? Php echo $ sf_request-> getParameter ('Total')?> // 2. segment version <? Php echo $ sf_params-> get ('Total')?> // 3. Execute the following code echo $ request-> getParameter ('Total') in the action ')

I hope this article will help you design PHP programs based on the Symfony framework.

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.