This article describes the core classes of Symfony. Share it with you for your reference. The details are as follows: The Symfony core class Symfony MVC method uses some of the classes you will often encounter later. sfController is a controller that decodes requests and delivers them to actions. sfRequest stores all request elements (parameters, Cookies, header information, and so on)
This article describes the core classes of Symfony. Share it with you for your reference. The details are as follows: The Symfony core class Symfony MVC method uses some of the classes you will often encounter later. sfController is a controller that decodes requests and delivers them to actions. sfRequest stores all request elements (parameters, Cookies, header information, and so on)
This article describes the core classes of Symfony. We will share this with you for your reference. The details are as follows:
Core classes of Symfony
The Symfony MVC method uses some classes that you will frequently encounter in the future.
1. sfController is a controller that decodes requests and delivers them to actions)
2. sfRequest stores all request elements (parameters, Cookies, header information, etc)
3. sfResponse contains the response header information and content, which are ultimately converted to HTML and sent to the user.
4. A context (obtained through sfContext: getInstance () stores the reference and existing configuration information of all core objects, which can be accessed anywhere.
As you can see, all symfony classes use the sf prefix, which avoids conflicts with your own classes or variables and makes the classes of the core framework easy to recognize.
Code Organization
You already know the different components of the symfony application, but you may not know how it is organized yet.
Project Structure: applications, modules, and actions
In symfony, a project is a group of services and operations under a domain name. They share the object model.
A project consists of multiple applications. An application consists of multiple modules. A module can contain multiple actions.
Project Structure:
Root tree structure and description of Symfony
Apps/ |
Contains the project application. An application corresponds to a folder. |
Batch/ |
Contains PHP code for command line execution or scheduling. |
Cache/ |
Cache folder, requires 777 permission |
Config/ |
Save basic project configurations |
Data/ |
Stores project data files, such as database structures, SQL files for creating data tables, or SQLite database files. |
Doc/ |
Store project documents, including your own documents and documents generated by PHPDoc |
Lib/ |
Data Model |
Log/ |
Log folder, requires 777 Permissions |
Plugins/ |
Plug-ins installed in applications |
Test/ |
Half-Worker Unit and common test |
Web/ |
WEB Service Root |
I hope this article will help you design PHP programs based on the Symfony framework.