我正在使用 CodeIgniter Bootstrap 样式表链接 URL 无法正常工作。 Controller 代码
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->helper('url');
$data['title'] = "Login Home";
$this->load->view('home',$data);
}
}
HTML代码
<div class="container">
<div class="row">
<div class="col-lg-offset-4 col-lg-4">
<div class="well">
<h3>welcome</h3>
</div>
</div>
</div>
</div>
CSS链接代码
<link href="<?php echo base_url("register/application/bootstrap-3.3.6/css/bootstrap.min.css"); ?>" rel="stylesheet">
最佳答案
Place assets out side of application. Reason the .htaccess in application folder blocks it.
application
assets
assets > bootstrap > css > bootstrap.css
assets > bootstrap > js > bootstrap.js
system
index.php
首先我会建议
配置/autoload.php
$autoload['helper'] = array('url');
然后
config/config.php 设置你的基本 url
$config['base_url'] = 'http://localhost/projectnmame/';
关于php - Base_url() 不适用于 codeigniter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42172787/