codeigniter 的新手,尝试使用简单的代码使用 base_url() 函数加载引导 css 文件。在 stackoverflow 上尝试了一些答案,但问题未解决。
我的视图名称是....articles_list.php 我的控制器名称... user.php
我编辑 config.php 如下 'localhost/ci';
我按如下方式编辑 autoload.php我在 autoload.php 中加载 url helper
article_list.php(在视图文件中加载 css)
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/bootstrap.css') ?>" >
用户.php(控制器)
$this->load->helper('url');
$this->load->view('public/articles_list');
当我运行我的视图文件时,css 没有加载,当我检查视图源时,它应该给我样式表 url 和链接地址,"localhost/ci/assets/css/bootstrap.css"但是当我看到它显示的视图源时<link href="localhost/ci/assets/css/bootstrap.css"> ,当鼠标悬停在链接上时,它会显示我的localhost/ci/localhost/ci/assets/css/bootstrap.css链接地址。请帮我解决这个问题并帮助我学习codeigniter。
慕田峪4524236