NicoleLi 发表于 2018-9-27 16:11:14

急急急 fontaweson 不能正常显示

我设置玩url 和 .htaccess文件之后
<link rel="stylesheet" href="<?php echo base_url('assets/css/font-aswesome.min.css')?>"
无法正常显示

config.php
$config['index_page'] = ""htaccessRewriteEngine onRewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1
ERROR:Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1/assets/fonts/fontawesome-webfont.woff2?v=4.7.0. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Hex 发表于 2018-9-27 17:20:27

配置一下 config.php 里的 base_url

NicoleLi 发表于 2018-9-27 17:47:29

$config ['base_url'] = 'localhost'

<?php
class Home extends CI_Model {

public function index()    {         $this->load->views('home');      $this->load->views('css/css');    }public function data()    {         $this->load->views('data');      $this->load->views('css/css');    }URL: localhost/home/data页面会无法显示格式
但是 home 页面没有问题,是我的url 设置又什么问题么


}

NicoleLi 发表于 2018-9-27 17:48:26

为啥上传之后格式错了

Hex 发表于 2018-9-27 19:03:46

NicoleLi 发表于 2018-9-27 17:48
为啥上传之后格式错了
你这样设置 base_url 是不对的,应该是这样 http://localhost 或者其他完整的 URL。

NicoleLi 发表于 2018-9-29 09:00:48

十分感谢哦,果然可以了
页: [1]
查看完整版本: 急急急 fontaweson 不能正常显示