Home > Article > PHP Framework > How to configure css path in thinkphp
When using the template of thinkphp5, you can directly place the css and other effect files that need to be introduced in the corresponding directory under /public/static/. When using the template file, you can directly,
5e63ffe8d590d4d6b82f049231eec044
,
Or
{load file="/static/admin/css/bootstrap.css"}
and other methods are introduced, but if the directory where these files are located is changed, in the code There will be a lot of changes in the general.
Here you can directly add <pre class="brush:php;toolbar:false">//模板引入js,css,img路径常量设置
&#39;view_replace_str&#39; => [
&#39;__CSS__&#39; =>&#39;/static/admin/css&#39;,
&#39;__JS__&#39; =>&#39;/static/admin/js&#39;,
&#39;__IMG__&#39; =>&#39;/static/admin/img&#39;,
&#39;__FONT__&#39; =>&#39;/static/admin/img&#39;,
]`</pre>
in the config.php
file under the application configuration file (
). It is not recommended to add Modify the project framework configuration file (/application
), so that the js and css constants that need to be loaded by different applications (admin
, home
) can be included module path.
For more ThinkPHP related technical articles, please visit the ThinkPHP usage tutorial column to learn!
The above is the detailed content of How to configure css path in thinkphp. For more information, please follow other related articles on the PHP Chinese website!