我有这个函数,我在验证中验证了
if($this->form_validation->run($this) == TRUE){
$this->form_validation->set_rules('userfile', 'Document', 'callback_pdf_upload2');
$this->form_validation->set_error_delimiters('<p class="text-danger"><i class="fa fa-times-circle-o"></i>','</p>');
if($this->form_validation->run($this) == TRUE){
print_r('abcd');
exit();
}else{
$this->add_view();
}
}else{
$this->add_view();
}
并没有得到我想要的颜色
不像这个
它们都具有相同的设计
$this->form_validation->set_message('pdf_upload', "<p class='text-danger'><i class=' fa fa-times-circle-o' ></i> No file selected</p>");
$this->form_validation->set_message('pdf_upload2', "<p class='text-danger'>".$this->upload->display_errors()."</p>");
答案 0 :(得分:1)
显示错误默认返回包含段落的字符串, 试试这个
$this->form_validation->set_message('pdf_upload2', $this->upload->display_errors('<p class="text-danger"><i class="fa fa-times-circle-o"></i>', '</p>') );