Home >PHP Framework >YII >How to import public files into Yii

How to import public files into Yii

尚
Original
2019-12-17 14:26:282056browse

How to import public files into Yii

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. Of course, you can write it once on every page, Ctrl C, Ctrl V, it won't waste much time.

But when this public part needs to be modified, it becomes more troublesome. The following is the solution for loading public files:

1. Use JS to define public methods and do it on the page that needs to be loaded. Loading

2. Use widgets (Widgets) and define widgets to perform loading

3. Use beginContent to load files directly

PHP Chinese website, there are a lot of freeYii Getting Started Tutorial, everyone is welcome to learn!

The above is the detailed content of How to import public files into Yii. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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