<?php
class 表單名字 extends \Poscms\Home\Form {
public function __construct() {
parent::__construct();
}
public function index() {
if (IS_POST && \Poscms\Service::M()->table($this->form_model->prefix.'_'.$this->form['table'])->where('title', dr_safe_replace($_POST['data']['title']))->getRow()) {
$this->call_msg(fc_lang('標(biāo)題title重復(fù)了,不能提交'));
}
$this->_post();
}
}
要自己寫(xiě)函數(shù),然后把函數(shù)名字填寫(xiě)到這里,就行,關(guān)鍵是自己怎么去寫(xiě)這個(gè)函數(shù)
回復(fù)@長(zhǎng)沙小陳 字段是 默認(rèn)的 標(biāo)題字段 可以 給寫(xiě)個(gè)例子嗎?
如果標(biāo)題重復(fù) 禁止提交留言,為什么要改這里呢?
回復(fù)@長(zhǎng)沙小陳這里不是 自帶了嗎 想了解下這個(gè) 功能
diy/app/form/controllers/表單名字.php
<?php class 表單名字 extends \Poscms\Home\Form { public function __construct() { parent::__construct(); } public function index() { if (IS_POST && \Poscms\Service::M()->table($this->form_model->prefix.'_'.$this->form['table'])->where('title', dr_safe_replace($_POST['data']['title']))->getRow()) { $this->call_msg(fc_lang('標(biāo)題title重復(fù)了,不能提交')); } $this->_post(); } }