The layout file of Yii2 can generally satisfy the loading of most public files, but there are still some situations where it cannot be satisfied, such as a common part in some pages. The situation is more difficult to handle.
Related tutorial sharing:yii framework
The following is the solution for loading public files:
1. Use JS to define public methods and use them when needed Load the loaded page;
2. Use widgets (Widgets) to define widgets to perform loading;
3. Use beginContent to load the file directly.
The public part is static. Just choose the corresponding method according to the actual situation.
For more programming related content, please pay attention to theProgramming Introductioncolumn on the php Chinese website!
The above is the detailed content of How to load public files in yii. For more information, please follow other related articles on the PHP Chinese website!