Parsing the import file tag in thinkphp _ PHP-php Tutorial

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

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 value of the type attribute. 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.

Load tag (use url to introduce resource files)

Close

Close tags

Attribute

Href (required): url address of the resource file to be introduced. variables are 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. for example:

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.