Summary of common path methods in Yii_PHP tutorial
Jul 13, 2016 am 09:53 AMA summary of common path methods in Yii
A summary of how to use some common path methods in the Yii framework.
Add CSS files or JavaScript files in the controller:
1 2 3 |
|
Call the js of framework/web/js/source in the YII framework. The file called by the registerCoreScript key can be viewed in the framework/web/js/packages.php list:
1 |
|
Get the ID of the current controller in the view:
1 |
|
Get the ID method of the current action in the view:
1 |
|
yii gets ip address
1 |
|
yii determines whether the submission method is a post request
1 |
|
yii determines whether it is an ajax request
1 |
|
Get the current domain name:
1 |
|
Get the physical path of the protected directory
1 |
|
Get the url of the previous page to return
1 |
|
Get the current url
1 |
|
Get current home url
1 |
|
Get the current return url
1 |
|
Project path
1 |
|
If you have a directory with some commonly used classes or files, you can define a path alias at the top of main.php, and the alias can be translated into its corresponding path.
1 |
|
If there are multiple configurations, you can add a configuration to the array in main.php.
Articles you may be interested in
- Yii rulesCommon verification rules memo
- Summary of how to use database transactions in Yii
- Yii View (output) the sql statement executed on the current page
- yii Database addition, modification, deletion related operations summary
- How to configure the default controller and action in the yii framework
- Yii controller action Parameter binding processing
- Yii action method skills
- Yii database query operation summary

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to evaluate the cost-effectiveness of commercial support for Java frameworks

How do the lightweight options of PHP frameworks affect application performance?

Golang framework documentation best practices

How to choose the best golang framework for different application scenarios

15 commonly used currency circle escape index technology analysis

How does the learning curve of PHP frameworks compare to other language frameworks?

Performance comparison of Java frameworks

Detailed practical explanation of golang framework development: Questions and Answers
