Home  >  Article  >  Backend Development  >  Parsing import file tags in thinkphp_PHP tutorial

Parsing import file tags in thinkphp_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:05:14858browse

The first one is the import tag. The import method adopts a namespace method similar to ThinkPHP’s import function, for example:

import标签(采用命名空间方式引入资源文件)

闭合

闭合标签

属性

file(必须):要引入的资源文件,支持变量

type(可选):引入的资源文件类型,默认为js,支持js css和php

basepath(可选):命名空间的基础路径


Example:

The Type attribute defaults to js, ​​so the following effect are the same:

can also support batch import of multiple files, for example:

The value of the type attribute must be specified when importing external CSS files, for example:

The default import starting path in the above method is the Public directory of the website. If you need to specify other directories, you can use the basepath attribute, for example:


The second is the load tag, which imports the public JS or CSS of the current project through files

load标签(采用url方式引入资源文件)

闭合

闭合标签

属性

href(必须):要引入的资源文件url地址,支持变量


For example:


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

Load The tag does not need to specify the type attribute, and the system will automatically determine it based on the suffix.
The system also provides two tag aliases js and css. The usage is consistent with load, for example:



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327725.htmlTechArticleThe first one is the import tag. The import method adopts a namespace method similar to ThinkPHP's import function, for example: import tag (Use namespace to introduce resource files) Close and close...
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