0

I have this view with codeigniter:

<!DOCTYPE html>
<html>
<head>  
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/bootstrap/css2/bootstrap.css"/>
<title>example</title>
</head> 
<body>
<p>Hello</p>
</body>
</html>

And this controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Merc_inicio extends CI_Controller {

    function index()
    {
        $this->load->view('plantilla');
    }
}   

?>

So in IE8 and Firefox the renderization is:

<html>
<head>
</head>
<body>
    <link href="http://10.66.130.131/mercurio_p/assets/bootstrap/css2/bootstrap.css" type="text/css" rel="stylesheet"></link>
<title>
      example
</title>
<p>Hello</p>
</body>
</html>

Why head tags is beig renderized inside body tags? I don't know what is happening. Do you?

4

2 回答 2

0

您必须将文件保存为没有 BOM 的 utf-8

于 2013-10-07T20:46:15.057 回答
0

尝试这个

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Merc_inicio extends CI_Controller {

function __construct(){
    parent::__construct();
    $this->load->helper('url');
    }
function index()
{
    $this->load->view('plantilla');
}
}   

?>
于 2013-10-07T12:36:17.330 回答