tp5css和js引入问题

由于以前用的是tp3.2,现在转用tp5开发个人博客,在引入CSS和JS的时候遇到了一些坑

在3.2时期需要在路径中添加public,而在tp5中则直接引入static即可。

在config.php下添加如下内容

<?php
return[
    'view_replace_str'       => [
        '__CSS__'   =>  'static/index/css',
        '__IMG__'   =>   'static/index/images',
        '__JS__'    =>  'static/index/js'
    ],
];

在public/static下创建对应的模块文件夹,在视图文件中路径引入如下:

至此,外部样式文件引入成功。

come on!~

猜你喜欢

转载自www.cnblogs.com/dlmg/p/11326823.html
今日推荐