AuthContext.php
645 Bytes
<?php
declare(strict_types=1);
namespace app\service;
/**
* 请求内管理员 / 小程序用户上下文(PHP-FPM 每请求独立进程,静态变量安全)
*/
class AuthContext
{
protected static ?array $admin = null;
protected static ?array $mpUser = null;
public static function setAdmin(array $row): void
{
self::$admin = $row;
}
public static function admin(): ?array
{
return self::$admin;
}
public static function setMpUser(array $row): void
{
self::$mpUser = $row;
}
public static function mpUser(): ?array
{
return self::$mpUser;
}
}