当我去:
codeigniter/index.php Bootstrap 样式加载良好。实际上是来自
的内容codeigniter/application/views/frontpage.php:
<div class="container">
<div class="hero-unit">
<h2>CodeIgniter Bootstrap</h2>
<p>CodeIgniter Bootstrap kick starts the development process of the web development process by including Twitter Bootstrap into CodeIgniter. It also includes certain libraries such as AWS and Facebook in-case you are developing applications requiring those SDKs. So stop writing the same code over again and start working on your idea.</p>
<a class="btn btn-primary btn-large" href="https://github.com/sjlu/CodeIgniter-Bootstrap">View on Github</a>
</div>
</div>
问题是当我将相同的内容复制粘贴到我自己的文件中时
codeigniter/application/views/index.php
它无法正确加载。我的 Controller 如下所示:
<?php
class Cart extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('cart_model'); // Load our cart model for our entire class
}
function index()
{
$data['products'] = $this->cart_model->retrieve_products(); // Retrieve an array with all products
$data['content'] = 'products'; // Select our view file that will display our products
$this->load->view('index', $data); // Display the page with the above defined content
}
}
/* End of file cart.php */
/* Location: ./application/controllers/cart.php */
首页 Controller 是:
<?php if (!defined('BASEPATH')) die();
class Frontpage extends Main_Controller {
public function index()
{
$this->load->view('include/header');
$this->load->view('frontpage');
$this->load->view('include/footer');
}
}
/* End of file frontpage.php */
/* Location: ./application/controllers/frontpage.php */
最佳答案
像
一样使用base_url()<link href="<?php echo base_url();?>assets/css/bootstrap.css" rel="stylesheet">
关于php - 为什么 CodeIgniter-Bootstrap 仅在 frontepage.php 中加载,但在我看来却没有加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22563658/