Quick variable usage instance of the Symfony template, and the symfony template instance. Quick variable usage example of the Symfony template. the example in this article describes the quick variable usage of the symfony template. For your reference, refer to the quick variable usage example of the Symfony template and the symfony template in the template.
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
Examples in this article describes the usage of quick variables in the Symfony template. Share it with you for your reference. The details are as follows: in the template...