1. We create a file directory under the assets directory in the shop directory (I take default as an example), create a css file directory under default, and put our css file directly Place it under this directory.
2. We create a php file in the config directory under the protected directory under the shop directory (I take function.php as an example). Create system variables in this file.
define("css_url", "http://127.0.0.1/yii/shop/assets/default/css/"); The first parameter is the system environment Variable name, the second parameter is the corresponding file path
3. After the environment variables are configured, we also need to introduce the file function.php## of the system environment we just configured into our project entry file. #
require dirname(__FILE__).'./protected/config/function.php';
<link href="<?php echo (css_url)?>User_Login.css" type="text/css" rel="stylesheet" />
The above is the detailed content of How to introduce css files in yii framework. For more information, please follow other related articles on the PHP Chinese website!