Skip to content
官方QQ交流群
技术交流1:87208295   点此加入
技术交流2:787747122   点此加入
官网
云控制台
开放平台
关注微信公众号
代码仓库: 码云

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表单验证"
  },
}
{
  "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表单验证"
  },
}

Copyright © 2017 10yun.com | 十云提供计算服务-IPV6 | ctocode组开发