安装部署
环境要求
- PHP 7.4 或更高版本
- cURL 扩展(用于HTTP请求)
- JSON 扩展(用于数据处理)
- 写入权限(用于缓存和日志)
快速开始
1. 下载授权系统
将 license/ 目录复制到你的项目中。
2. 引入授权系统
// 在入口文件(如 config.php)顶部引入
require_once __DIR__ . '/license/LicenseManager.php';
// 使用核心类
use LicenseSystem\LicenseManager;
3. 配置授权参数
$config = [
'license_mode' => 'domain', // 授权模式
'verify_url' => 'https://auth.xenl.ac.cn/license/api/verify.php',
'license_key' => '你的授权码',
'app_key' => '你的应用密钥',
];
4. 启动验证
$manager = LicenseManager::getInstance($config);
if (!$manager->verify()) {
$manager->renderErrorPage();
exit;
}
提示:也可以使用便捷函数方式:
require_once 'license/LicenseMiddleware.php'; 然后调用 \LicenseSystem\LicenseMiddleware::boot();