Home>Article>Backend Development> Share the solution for importing resource files into ThinkPHP template engine

Share the solution for importing resource files into ThinkPHP template engine

不言
不言 Original
2018-06-19 15:49:19 1570browse

This article mainly introduces the method of importing resource files of ThinkPHP template engine. Friends who need it can refer to it

Generally speaking, the traditional way of importing resource files such as external JS and CSS on web pages is to directly Use in the template file:

 

##2.load tag

The second is the load tag, which imports the public JS or CSS of the current project through the URL, for example:

  

You can use special template tags in the href attribute, for example:

Load tag There is no need to specify the type attribute, the system will automatically determine it based on the suffix.

Of course, the load tag also supports conditional judgment calls:

The system also provides two tag aliases js and css. The usage is consistent with load., for example:

 

The load tag also supports importing multiple resource files at the same time, even different types of resource files:

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!


Related recommendations:

About the implementation method of custom validator in thinkPHP5 framework

For Laravel framework template Functionality for loading and assigning variables and simple routing

The above is the detailed content of Share the solution for importing resource files into ThinkPHP template engine. 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