# License-Plate-Simulation **Repository Path**: zesso/License-Plate-Simulation ## Basic Information - **Project Name**: License-Plate-Simulation - **Description**: PHP编写的车牌生成器,支持开放API,生成并自定义包括中国黄牌,蓝牌,新能源在内的车牌。本工具仅供娱乐、影视道具制作或设计参考,严禁用于制作假牌、套牌等违法行为,违者后果自负。 - **Primary Language**: PHP - **License**: GPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-19 - **Last Updated**: 2026-05-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 中国车牌生成器 ## 功能特性 - ✅ **蓝牌**(小型汽车):深蓝底白字,7位号码 - ✅ **黄牌**(大型汽车/货车):黄底黑字,7位号码 - ✅ **黄牌双行**(挂车/教练车):黄底黑字,上下两行排列 - ✅ **绿牌-小型**(新能源):绿底白字,8位号码 - ✅ **绿牌-大型**(新能源公交车/货车):绿底白字,8位号码 - ✅ 随机车牌号生成 - ✅ PNG/JPG 格式下载 - ✅ 多种输出尺寸(1x/2x/4x) - ✅ 高清 3 倍渲染 + 缩放输出,文字锐利 ## 环境要求 - PHP 7.4+ - GD 库(通常 PHP 自带) - 中文字体文件(simhei.ttf / msyh.ttc 等) ## 安装部署 ### 1. 克隆/复制项目 ```bash cp -r license-plate-generator /var/www/html/plate ``` ### 2. 安装字体 **Windows:** ```powershell copy C:\Windows\Fonts\simhei.ttf fonts\ ``` **Linux:** ```bash # Ubuntu/Debian apt install fonts-wqy-microhei cp /usr/share/fonts/truetype/wqy/wqy-microhei.ttc fonts/ ``` ### 3. 设置权限 ```bash chmod 755 output/ chown www-data:www-data output/ ``` ### 4. 访问 浏览器打开 `http://your-server/plate/index.php` ## 目录结构 ``` license-plate-generator/ ├── index.php # 主程序(前端+后端一体) ├── fonts/ # 字体文件目录 │ └── README.md # 字体说明 ├── output/ # 图片输出目录(可选) └── README.md # 本文件 ``` ## API 接口 ### 生成车牌图片 ``` GET /index.php?action=generate&plate=京A12345&type=blue&format=png&scale=2 ``` 参数说明: | 参数 | 必填 | 说明 | |------|------|------| | action | 是 | 固定值 `generate` | | plate | 是 | 车牌号码 | | type | 是 | 车牌类型:blue/yellow/yellow_double/green/green_large | | format | 否 | 输出格式:png(默认)/jpg | | scale | 否 | 输出缩放:1/2(默认)/4 | | download | 否 | 设为1时触发浏览器下载 | ### 随机车牌号 ``` GET /index.php?action=random&type=blue ``` 返回 JSON:`{"plate":"京A12345"}` ## 车牌类型对照 | 类型 | type 值 | 底色 | 字色 | 号码位数 | 尺寸 | |------|---------|------|------|---------|------| | 蓝牌(小型汽车) | blue | 深蓝 | 白 | 7 | 440×140 | | 黄牌(大型汽车/货车) | yellow | 黄 | 黑 | 7 | 440×140 | | 黄牌双行(挂车/教练车) | yellow_double | 黄 | 黑 | 7 | 280×180 | | 绿牌(新能源-小型) | green | 绿 | 白 | 8 | 480×140 | | 绿牌(新能源-大型) | green_large | 绿 | 白 | 8 | 480×140 | ## 注意事项 - 仅供学习和模拟使用,请勿用于非法用途 - 服务器必须安装 GD 库(`php -m | grep gd` 检查) - 中文字体是必需的,否则无法正确渲染省份简称 - 建议使用 Nginx/Apache 部署,PHP 内置服务器仅用于开发测试 ## 开发测试 ```bash php -S localhost:8080 # 浏览器访问 http://localhost:8080 ``` ## License MIT