PHP code example of haojohnny / tp6-curd

1. Go to this page and download the library: Download haojohnny/tp6-curd library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

haojohnny / tp6-curd example snippets




    return [
        'Haojohnny\Tp6Curd\Command\Curd',
        'Haojohnny\Tp6Curd\Command\Model',
        'Haojohnny\Tp6Curd\Command\Validate',
        'Haojohnny\Tp6Curd\Command\Controller',
    ];


// +--
// | Date: 2019-07-07 11:34
// | Remark:
// |

namespace app\index\validate;

use think\Validate;

class User extends Validate
{
    /**
     * 定义验证规则
     * 格式:'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'user_id' => ''�为数字',
        'wechat_nickname.�在城市必须填写',
        'city.max' => '所在城市最大长度为64个字符',
        'wechat_union_id.��填写',
        
    ];

    protected $scene = [
        'insert' => ['wechat_nickname', 'avatar_url', 'province', 'city', 'wechat_union_id', 'applet_open_id', 'gender', 'mobile', 'reg_time'],
        'update' => ['user_id', 'wechat_nickname', 'avatar_url', 'province', 'city', 'wechat_union_id', 'applet_open_id', 'gender', 'mobile', 'reg_time'],        
    ];
}