if you add public $uid=Cookie::get ("uid")
to the validation class like this, you will report an error. Why do you report an error? Can"t you use cookie like this?
<?php
namespace app\index\validate;
use think\Validate;
use think\facade\Cookie;
class User extends Validate
{
public $uid=Cookie::get("uid");
protected $rule = [
"uid" => "number|between:1,120",
];
}