Quick variable usage instance of the Symfony template, and symfony template instance

Source: Internet
Author: User
Tags php framework

Quick variable usage instance of the Symfony template, and symfony template instance

This example describes the usage of quick variables in the Symfony template. 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.

Articles you may be interested in:
  • Session and cookie usage in Symfony2
  • Summary of how Symfony2 can obtain data from the database
  • Symfony2: how to obtain a url in the controller
  • Symfony2 framework learning notes
  • Explanation of HTTP Cache Usage in Symfony2 framework learning notes
  • In-depth description of Symfony control layer
  • Symfony core class overview
  • How to create a project using the symfony command
  • Details about how to create a project and a template setting instance in the Symfony2 framework
  • Quick Start to Symfony
  • High-performance PHP framework Symfony2 classic getting started tutorial
  • Analysis on date usage in twig of symfony2.4

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.