|
各位前辈,大家好!
我用CI搭了个博客,后台发表文章的时候用了kindedit编辑器,文章的主题内容提交到后台控制器,再调用模型插入数据库。验证表单用了form_validation类,验证规则应该没有错,有时候能插入数据,有时候插入就是空的。(就是说有时候能正常发表,有时候发表为空)这个比较苦恼。
后台关键代码:
控制器表单验证规则:
//var_dump($_POST);//这里打出来的表单数据都是对的
$this->form_validation->set_rules('title', '文章标题', 'required|min_length[5]');
$this->form_validation->set_rules('type', '类型', 'required|integer');
$this->form_validation->set_rules('cid', '栏目', 'integer');
$this->form_validation->set_rules('info', '摘要', 'required|max_length[155]');
$this->form_validation->set_rules('content', '内容', 'required');
//$status = $this->form_validation->run('article');
//post数据打包到数组
$data = array(
'title' => $this->input->post('title'),
'type' => $this->input->post('type'),
'cid' => $this->input->post('cid'),
'thumb' => $thumb_name,
'info' => $this->input->post('info'),
'content'=> $this->input->post('content'),
'time' => time()
);
//p($data);die;//有时候这里打出来的数据content字段是空的值,其他的都是有值的
$this->art->add($data);
在art模型中:
public function add($data){
//p($data);die;
$this->db->insert('article', $data);
}
前台表单提交:
logs爆出的错误:
ERROR - 2015-07-19 13:34:56 --> Severity: Warning --> preg_replace(): Compilation failed: regular expression is too large at offset 37678 D:\Program_Tools\wamp\www\ci\system\core\Security.php 642
ERROR - 2015-07-19 13:34:57 --> Severity: 8192 --> mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead D:\Program_Tools\wamp\www\ci\system\database\drivers\mysql\mysql_driver.php 91
ERROR - 2015-07-19 13:54:23 --> Severity: Warning --> preg_replace(): Compilation failed: regular expression is too large at offset 37678 D:\Program_Tools\wamp\www\ci\system\core\Security.php 642
ERROR - 2015-07-19 13:54:23 --> Severity: 8192 --> mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead D:\Program_Tools\wamp\www\ci\system\database\drivers\mysql\mysql_driver.php 91
各位前辈帮忙看看指点指点,这个问题困扰好久了,搜都没有解决方案,在这里先谢谢各位前辈了!
@Hex
@版主
|
|