有些时候我们需要自定义一些全局函数来完成我们的工作. 方法一: 直接写在入口文件处 <?php // comment out the following two lines when deployed to production defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require __DIR__ . '/../vendor/autolo
public function rules(){ return [ ['title','required','message'=>'标题不能为空'], ['title','string','min'=>2,'max'=>200,'tooShort'=>'标题不能少于两位','tooLong'=>'标题不能大于200位'], ['content','required','message'=>'内容不能为空'], ['description','string','max'=