php快捷模版配置 ¶
__php模版.code-snippets
json
{
"php_check_models": {
"prefix": "<?p",
"body": [
"<?php",
"",
"namespace addons\\xxxxxxx\\models;",
"",
"use shiyun\\model\\ModelCheckExt;",
"",
"class XxxXxxModels extends ModelCheckExt",
"{",
" protected \\$table = 'xxx_table_name';",
" protected \\$pk = 'xxx_pk_id';",
" protected \\$check_exist_field = [",
" 'xxx_name' => '名称,已存在',",
" ];",
"}",
],
"description": "php模型验证"
},
"php_check_validate": {
"prefix": "<?p",
"body": [
"<?php",
"",
"namespace addons\\xxxxxxx\\validate;",
"",
"use shiyun\\validate\\ValidateExtend;",
"",
"class XxxXxxValidate extends ValidateExtend",
"{",
" protected \\$rule = [",
" 'id' => [",
" 'require', 'number', 'regex' => '/^[1-9]{1}\\d{0,9}$/',",
" ],",
" 'xxxxx' => [",
" 'require'",
" ],",
" ];",
" protected \\$message = [",
" 'id' => [",
" 'require' => 'id不能为空',",
" 'number' => 'id格式错误',",
" 'regex' => 'id参数错误',",
" ],",
" 'xxxxx' => [",
" 'require' => 'xxx名称不能为空',",
" ],",
" ];",
" protected \\$scene = [",
" 'postData' => ['xxxxx',],",
" 'putById' => ['id',],",
" 'deleteById' => ['id',],",
" ];",
"}",
],
"description": "php表单验证"
},
}