/**
* 验证规则
*/
protected $rule = [
'title' => 'require|token',
'image' => 'require',
'content' => 'require', // 奇怪富文本中包含图片时,验证为空
'cid' => 'require',
];
/**
* 提示消息
*/
protected $message = [
'title.require' => '请输入名称',
'title.token' => '请勿重复提交',
'image' => '请上传图片',
'content' => '请输入详情',
'cid' => '请选择分类',
];
/**
* 验证场景
*/
protected $scene = [
'add' => [
'title',
'image',
'content',
'cid',
],
'edit' => [
'title',
'image',
'content',
'cid',
],
];很奇怪, content 字段啊, 只要是纯文本, 验证器正常!若富文本只上传一张图片时, 验证器 验证为空!
若富文本 是图文状态 , 验证器也是正常!
// 获取当前请求的所有变量(原始数据)
Request::instance()->param(false); 应该这样写, 原先的写法过滤掉了content
最佳答案