مبر*_*طنة 3 php jquery codeigniter
如何在控制器中使用{ci_form_validation field ='title'error ='true'}?
我有这个代码
$this->load->library('form_validation');
$this->form_validation->set_rules('title', $this->lang->line('title'), 'trim|required|min_length[3]|xss_clean');
$this->form_validation->set_rules('fahad', $this->lang->line('blog'), 'trim|required|min_length[20]|xss_clean');
$this->form_validation->set_rules('writer', $this->lang->line('writer'), 'trim|required|alpha_dash|min_length[3]|xss_clean');
Run Code Online (Sandbox Code Playgroud)
我想在控制器中打印错误消息因为我正在使用jquery.
从用户指南中使用此功能
echo form_error('field_name');
Run Code Online (Sandbox Code Playgroud)
EDITED
好的尝试
echo validation_errors();
Run Code Online (Sandbox Code Playgroud)
这将为您提供每个错误,之后您可以得到您想要的