1. Component development and composer usage
A. Component development
B.composer uses
C. Manually build the Laravel framework
1.index.php: Adding automatic loading functions, service container instantiation and service registration, route loading, request instantiation and route distribution, response generation and sending
2.composer dump-autoload: Update automatic loading file
2. Laravel framework installation and debugging environment establishment
1.composer installation
Command 1: composer global require “laravel/installer=~1.1”
Command 2: composer create-project laravel/laravel —prefer-dist
3. Commonly used PHP syntax in Laravel framework
A. Component-based development syntax conditions
1. Namespace
PHP namespace only supports imported classes, not functions or constants
For names in the namespace, backslashes are not allowed at the beginning
Fully qualified names of functions, classes and constants can be parsed directly
Convert all unqualified and non-fully qualified functions, classes, and constants according to the currently imported namespace
Within a namespace, all unqualified and non-fully qualified names that are not converted according to import rules will have the current namespace name
prepended to them.
Within the namespace, when calling functions with unqualified names and unqualified names, they are first parsed in the current namespace. If not found, they are searched in the global space
When calling classes with unqualified names and non-fully qualified names within a namespace,
will only be resolved under the current namespace.
2. The file contains
require produces an error and include warns
Automatic loading through __autoload or spl_autoload_register() method
In the Laravel architecture, the registration of class autoloading functions is implemented through the function spl_autoload_register. The autoloading function queue of the class contains the autoloading functions of two classes. One is the autoloading function based on the PSR specification generated by composer, and the other is Laravel framework core alias autoloading function
Statement:
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn