网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

Yii2.0使用教程(四)

时间:2024-11-06 13:43:47

1、勃谧锵疙访问Url优化以首页链接为例:http://c.com/index.php?r=site%2Findexa、打开/front髫潋啜缅end/config/main.php中的components下面添加代码,主要是开启apache-rewrite,代码如下:'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'suffix'=>'.html', 'rules' => [ ], ],b、在/frontend/web/目录下编写一个.htaccess 文件,内容如下:<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php [QSA,PT,L]</IfModule>c、访问就可以如此,首页链接就变成:http://c.com/site/index.html

Yii2.0使用教程(四)Yii2.0使用教程(四)Yii2.0使用教程(四)Yii2.0使用教程(四)

2、静漤逗庞俄态资源配置a、在/frontend/web中创建statics文件夹作为frontend的前端茹霭庖褙资源文件b、在statics目录下创建3个文件夹,css、js、images,存放css文件,js文件,和图片。c、打开/frontend/assets/AppAsset.php 修改内容如下:修改其中css/site.css更改为statics/css/site.css(js依此类推)

Yii2.0使用教程(四)Yii2.0使用教程(四)Yii2.0使用教程(四)
© 2025 一点资料
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com