【问题标题】:CSS and pictures not loading in CodeigniterCSS 和图片未在 Codeigniter 中加载
【发布时间】:2017-02-24 03:53:59
【问题描述】:

使用base_url() 编写的所有内容都不会加载到 Codeigniter 中。

<link href="<?php echo base_url(); ?>other/css/admin/style.css" rel="stylesheet" type="text/css">
<img class="brand" src="<?php echo base_url(); ?>other/img/logo.png">

有:

wamp -> www -> 其他 -> css/img

我的 base_url 是:

$base_url = 'http://localhost/';

【问题讨论】:

  • 你的base_url是什么?
  • know怎么用base_url()
  • 当然,我愿意。请参阅上面的示例。
  • 确保你的css和东西在根目录和你的基本url应该是$config['base_url'] = 'http://localhost/projectname/';而不是$config['base_url'] = 'http://localhost/';在application/config/config,php上

标签: php html css codeigniter


【解决方案1】:

将您的基本网址更改为:

$base_url = 'http://localhost/PROJECTNAME/';

这里的“PROJECTNAME”是你的项目目录。

【讨论】:

    【解决方案2】:

    像这样改变你的 base_url 变量:

    $base_url = 'http://localhost/other/';
    

    其中“其他”是项目文件夹

    【讨论】:

      【解决方案3】:

      将您的基本网址更改为:

      $base_url = '/';
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-12
        • 1970-01-01
        相关资源
        最近更新 更多