中间件-域名绑定

1.0.0 2025-05-29 07:45 UTC

This package is auto-updated.

Last update: 2025-06-02 08:50:53 UTC


README

  • 仅限在webman中使用

安装仓库

composer require alone-webman/domain

中间件方法

  • 可以任何config/middleware.php中使用
/**
 * @param array|string $domain 域名列表 支持*.域名
 * @param Closure|null $error  不支持域名时显示内容
 */
return [
    '@' => [alone_mid_domain(array|string $domain = "", Closure|null $error = null)]
];

判断域名方法

  • 不使用中间件时可以使用此方法
/**
 * 判断域名
 * @param string       $domain 当前访问的域名
 * @param array|string $list   *=全部开放 支持*.域名
 * @param bool         $type   是否允许使用*
 * @return bool true=允许访问,false=禁止访问
*/
alone_domain(string $domain, array|string $list, bool $type = true): bool