Home > PHP Framework > YII > body text

How to import css files into yii

王林
Release: 2020-02-18 15:40:23
Original
2542 people have browsed it

How to import css files into yii

The CClientScript class is used in Yii to manage the css file of the view. How to use:

Introduce the css file

(recommended related article tutorials: yii framework)

<?php
Yii::app()->getClientScript()->registerCssFile("/css/main.css");
?>
Copy after login

The advantage of using the CClientScript class to introduce files (js/css) is that we can introduce the private files of the view in different view files instead of in the layout Introducing it into the file can save resources.

For more programming related content, please pay attention to the Programming Introduction column on the php Chinese website!

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!