您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

phalcon中model中验证报错

2024/2/19 22:35:57发布23次查看
报错信息
catchable fatal error: argument 1 passed to phalcon\mvc\model::validate() must implement interface phalcon\validationinterface, instance of phalcon\mvc\model\validator\presenceof given in c:\wamp\www\test\apps\models\robots.php on line 49

model中的验证代码
use phalcon\mvc\model\validator\presenceof;use phalcon\mvc\model\validator\uniqueness;public function validation() { $this->validate( new presenceof( array( field => name, message => self::name_not_empty ) ) ); $this->validate( new uniqueness( array( 'field' => 'code', 'message' => self::err_code_not_unid ) ) ); if ($this->validationhasfailed() == true) { return false; } return true; }

回复内容: 报错信息
catchable fatal error: argument 1 passed to phalcon\mvc\model::validate() must implement interface phalcon\validationinterface, instance of phalcon\mvc\model\validator\presenceof given in c:\wamp\www\test\apps\models\robots.php on line 49

model中的验证代码
use phalcon\mvc\model\validator\presenceof;use phalcon\mvc\model\validator\uniqueness;public function validation() { $this->validate( new presenceof( array( field => name, message => self::name_not_empty ) ) ); $this->validate( new uniqueness( array( 'field' => 'code', 'message' => self::err_code_not_unid ) ) ); if ($this->validationhasfailed() == true) { return false; } return true; }

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product