Shortcut variable usage examples of Symfony templates, symfony template examples_PHP tutorial

WBOY
Release: 2016-07-12 08:56:52
Original
857 people have browsed it

Symfony template shortcut variable usage examples, symfony template examples

This article describes the shortcut variable usage examples of Symfony templates. Share it with everyone for your reference, the details are as follows:

In the template, there are some symfony variables that can be used directly. Some of the most commonly used template information can be obtained from symfony objects through these shortcut variables:

$sf_context: complete environment object (instance of sfContext class)
$sf_request: request object (instance of sfRequest class)
$sf_params: Requested parameters
$sf_user: Current user session object (instance of sfUser class)

Three common ways to use it:

//1. 长版本
<&#63;php echo $sf_request->getParameter('total') &#63;>
//2. 段版本
<&#63;php echo $sf_params->get('total') &#63;>
//3. 相当于在行为里执行下面的代码
echo $request->getParameter('total')

Copy after login

I hope this article will be helpful to everyone’s PHP program design based on the Symfony framework.

Articles you may be interested in:

  • Symfony2 session and cookie usage summary
  • Symfony2 implementation method to obtain data from the database summary
  • Symfony2 implementation in Method of obtaining url in controller
  • Detailed explanation of form usage in Symfony2 framework study notes
  • Detailed explanation of HTTP Cache usage in Symfony2 framework study notes
  • In-depth detailed explanation of Symfony control layer
  • Overview of Symfony core classes
  • How to use symfony commands to create projects
  • Detailed examples of creating projects and template settings with the Symfony2 framework
  • Ten-minute classic tutorial for getting started with Symfony
  • Classic introductory tutorial for high-performance PHP framework Symfony2
  • Analysis of date usage in twig of symfony2.4

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1111330.htmlTechArticleSymfony template shortcut variable usage examples, symfony template examples This article describes the shortcut variable usage of Symfony templates. Share it with everyone for your reference, the details are as follows: In the template...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template