无法使用Codeigniter从mysql数据库中显示特殊字符..显示"描述"

时间:2016-12-08 12:32:18

标签: mysql codeigniter

  • 插入/更新成功,但它在表格中显示为:
  • 例如字符"描述"显示不正确。
  • 数据库及其表格为utf8_general_ci

    控制器:

    function add()
    {           
        if ($this->input->server('REQUEST_METHOD') === 'POST')
        {                   
    
        $this->form_validation->set_rules('question', 'question', 'required');
        $this->form_validation->set_rules('answer', 'answer', 'required');
        $this->form_validation->set_error_delimiters('<br /><em class="error">', '</em>');
    
        if ($this->form_validation->run() == FALSE) // valf_idation hasn't been passed
        {
    
        }
        else // passed valf_idation proceed to post success logic
        {
    
        $form_data = array(
            'question' => set_value('question'),
            'answer' => set_value('answer')
    
            if ($this->Faq_model->setClientData($form_data) == TRUE) 
            {
                $this->session->set_flashdata('flash_message', 'Client Saved Successfully');
                $this->session->set_flashdata('flash_type', 'success');
            }
            else
            {
                $this->session->set_flashdata('flash_message', 'Oops Error Occured While Saving Client');   
                $this->session->set_flashdata('flash_type', 'error');   
            }
                redirect('admin/faq');
            }
            }
    
        $data['main_content'] = 'admin/faq/add';
        $this->load->view('includes/template', $data);
    }
    

1 个答案:

答案 0 :(得分:0)

当您显示说明时,只需使用html_entity_decode();功能即可显示。我认为它会起作用你想要的。

参考:html_entity_decode()