Parse the import file tag in thinkphp

Source: Internet
Author: User
This article provides a detailed analysis of the import file labels in thinkphp. For more information, see

This article provides a detailed analysis of the import file labels in thinkphp. For more information, see

The first is the import tag. The import method adopts the namespace method similar to the import function of ThinkPHP, for example:

Import tag (use namespace to introduce resource files)

Close

Close tags

Attribute

File (required): The resource file to be introduced. variables are supported.

Type (optional): type of the introduced resource file. The default value is js. js css and php are supported.

Basepath (optional): basic path of the namespace


Example:

The default Type attribute is js, so the following effects are the same:

You can also import multiple files in batches, for example:

To import an external CSS file, you must specify the type attribute value, which is rented by a Hong Kong server. For example:

In the above method, the default import start path is the Public directory of the website. 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 the file method.

LoadTag (use url to introduce resource files)

Close

Close tags

Attribute

Href (required): url address of the resource file to be introduced, U.S. space, variable supported


For example:


You can replace the href attribute with a special template tag, for example:

You do not need to specify the type attribute for the Load tag. The system automatically determines the type based on the suffix.
The system also provides two label aliases. js and css are used in the same way as load. The Hong Kong virtual host, for example:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.