When the controller is directly echo, some browsers will appear garbled. The following two methods can be used to solve the problem:
1, commonly used in the header function of PHP
Copy the Code code as follows: Header ("Content-type:text/html;charset=utf-8");
Example:
Copy the Code code as follows: class Home extends Ci_controller {
Function index ()
{
Set encoding
Header ("Content-type:text/html;charset=utf-8");
echo ' Test output ';
}
}
?>
2, use the output class to solve
Copy the Code code as follows: $this->output->set_content_type (' application/html;charset=utf-8 ');
$this->output->set_output ("Test output");
http://www.bkjia.com/PHPjc/788623.html www.bkjia.com true http://www.bkjia.com/PHPjc/788623.html techarticle when the controller is directly echo, some browsers will appear garbled. can be resolved in the following two ways: 1, the common PHP header function copy code is as follows: Header ( ...)