phpcms的评论默认没有字符控制,但是有时候必须多评论加入字符控制就需要修改如下地方
进入:phpcms/modules/comment/目录下,打开index.php文件
修改下面的函数
public function post()
找到下面的部分修改控制字符不少于4个,如果是中文,需要添加相应的函数来判断中文字符
(红色字体是修改成的内容,蓝色字体是语言包要修改的地方。)
$content = isset($_POST['content']) && strlen(trim
($_POST['content']))>4 ? trim($_POST['content']) : $this->_show_msg(L
('please_enter_content'), HTTP_REFERER);
$direction = isset($_POST['direction']) && intval
($_POST['direction']) ? intval($_POST['direction']) : '';
$data = array('userid'=>$userid,
再次修改语言包文件
phpcms/languages/zh-cn/comment.lang.php
$LANG['please_enter_content'] = '请输入至少5个字符的评论内容。';