[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"getwebinfo":3,"news-item-41":4},null,{"classListRes":-1,"articleRes":5},{"code":6,"msg":3,"data":7,"total":3},200,{"id":8,"dwo_html":9,"dwo_name":10,"dwo_image":11,"dwo_time":12,"dwo_brief":13,"dwo_keywords":14,"dwo_cid":15,"dwo_show":16,"dwo_uid":17,"dwo_status":18,"dwo_comment_count":19,"dwo_status_reason":3,"dwo_status_time":3,"status_text":20},41,"\u003Ch2 style=\"text-align: start;\">什么是Hyperf Api？\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">基于 Hyperf 3.1 构建的后台管理与会员服务系统，面向 API 接口平台、内容站点和积分运营场景。系统内置后台管理端、用户中心、CMS 内容管理、接口市场、支付订单、积分商城、短信、工单、搜索索引和在线安装能力，可作为业务后台或接口服务平台的基础骨架继续扩展。\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">核心功能\u003C\u002Fh2>\u003Cul>\u003Cli style=\"text-align: start;\">后台管理：管理员登录、角色组、菜单规则、操作日志、系统配置、附件、区块和友情链接管理。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">会员体系：用户注册登录、资料维护、余额与积分、签到、等级、邀请、地址和资产流水。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">API 平台：接口分类、接口详情、API Key、套餐、VIP、兑换码、调用日志、计费扣减和用户购买能力。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">CMS 内容管理：栏目、内容模型、字段配置、内容、标签、评论、搜索日志、付费记录，以及前台栏目、详情、搜索、标签页。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">支付订单：支持余额充值、积分充值、API 套餐、CMS 付费内容等业务场景的支付处理，并预留支付宝、微信、易支付通道。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">积分商城：商品分类、商品、卡密、兑换、发货、退款与用户兑换记录。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">工单系统：用户提交工单、回复工单，后台处理与关闭工单。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">短信能力：短信通道配置、模板、变量解析和验证码发送。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">搜索与 SEO：Elasticsearch \u002F Scout 索引管理、站点地图、RSS、robots.txt 与百度推送服务。\u003C\u002Fli>\u003Cli style=\"text-align: start;\">在线安装：提供数据库、Redis、Elasticsearch 连接检测，支持写入环境配置并执行初始化流程。\u003C\u002Fli>\u003C\u002Ful>\u003Ch2 style=\"text-align: start;\">技术栈\u003C\u002Fh2>\u003Cul>\u003Cli style=\"text-align: start;\">PHP 8.2+\u003C\u002Fli>\u003Cli style=\"text-align: start;\">Hyperf 3.1\u003C\u002Fli>\u003Cli style=\"text-align: start;\">Swoole协程运行环境\u003C\u002Fli>\u003Cli style=\"text-align: start;\">MySQL\u003C\u002Fli>\u003Cli style=\"text-align: start;\">Redis\u003C\u002Fli>\u003Cli style=\"text-align: start;\">Elasticsearch\u002FHyperf Scout\u003C\u002Fli>\u003Cli style=\"text-align: start;\">Twig 模板引擎\u003C\u002Fli>\u003Cli style=\"text-align: start;\">Pest、PHPUnit、PHPStan、PHP-CS-Fixer\u003C\u002Fli>\u003C\u002Ful>\u003Ch2 style=\"text-align: start;\">环境要求\u003C\u002Fh2>\u003Ctable style=\"width: auto; text-align: start;\">\u003Ctbody>\u003Ctr>\u003Cth colspan=\"1\" rowspan=\"1\" width=\"auto\" style=\"text-align: center;\">组件\u003C\u002Fth>\u003Cth colspan=\"1\" rowspan=\"1\" width=\"auto\" style=\"text-align: center;\">版本\u003C\u002Fth>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">Nginx\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">1.30.3\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">MySQL\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">8.4.8\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">PHP\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">8.2.31\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">Swoole\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">6.x\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">Redis\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\" width=\"auto\">需安装（扩展 + 服务）\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cblockquote style=\"text-align: start;\">提示：Hyperf 3.1 要求 PHP ≥ 8.1，本教程使用 PHP 8.2。请确保面板中已安装 Redis 服务（用于缓存\u002F队列等）。\u003C\u002Fblockquote>\u003Chr\u002F>\u003Cp style=\"text-align: start;\">\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">1. 新建 MySQL 数据库\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">在宝塔面板 \u003Cstrong>数据库\u003C\u002Fstrong> 中新建一个数据库，记下数据库名、用户名和密码，后续安装页面需要填写。\u003C\u002Fp>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002Fcb4956a9255a851d455855e6db1b3982.jpg\" alt=\"2\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Chr\u002F>\u003Cp>\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">2. 配置 PHP 8.2 扩展\u003C\u002Fh2>\u003Ch3 style=\"text-align: start;\">2.1 安装必要扩展\u003C\u002Fh3>\u003Cp style=\"text-align: start;\">进入 \u003Cstrong>软件商店 → PHP 8.2 → 设置 → 安装扩展\u003C\u002Fstrong>，依次安装：\u003C\u002Fp>\u003Cul>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>fileinfo\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>redis\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>Swoole6\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003C\u002Ful>\u003Cblockquote style=\"text-align: start;\">Swoole 是 Hyperf 的运行基础，必须安装；redis 扩展用于连接 Redis 服务；fileinfo 是常见依赖。\u003C\u002Fblockquote>\u003Ch3 style=\"text-align: start;\">2.2 关闭 Swoole 短名称\u003C\u002Fh3>\u003Cp style=\"text-align: start;\">进入 \u003Cstrong>软件商店 → PHP 8.2 → 设置 → 配置文件\u003C\u002Fstrong>，新增以下配置项并保存：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>swoole.use_shortname = 'Off'\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002F611f6146425bad3db725f2b5811ffd5a.jpg\" alt=\"3\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Cblockquote style=\"text-align: start;\">为什么要关闭：Swoole 默认会注册 go()、defer() 等短别名函数，这些会与 Hyperf 框架内部的同名函数冲突，导致启动报错，因此必须关闭。\u003C\u002Fblockquote>\u003Chr\u002F>\u003Cp>\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">3. 解除 PHP 禁用函数\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">宝塔面板出于安全考虑默认禁用了一批函数，但 Hyperf 依赖这些函数来管理进程和协程，需要解除禁用。\u003C\u002Fp>\u003Cp style=\"text-align: start;\">进入 \u003Cstrong>软件商店 → PHP 8.2 → 设置 → 禁用函数\u003C\u002Fstrong>，删除以下函数：\u003C\u002Fp>\u003Cul>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>exec\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>putenv\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>proc_open\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>pcntl_fork\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003Cli style=\"text-align: start;\">\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>pcntl_wait\u003C\u002Fcode>\u003C\u002Fspan>\u003C\u002Fli>\u003C\u002Ful>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002Fe740d5bd07be2b127ee76515f4b2b8b8.jpg\" alt=\"4\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Cblockquote style=\"text-align: start;\">这些函数用于子进程管理、信号处理和协程调度，缺一不可。删除后建议重启 PHP。\u003C\u002Fblockquote>\u003Chr\u002F>\u003Cp>\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">4. 上传并解压程序\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">将程序压缩包 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>HyperfApi.zip\u003C\u002Fcode>\u003C\u002Fspan> 上传到建站目录（本教程为 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>\u002Fdata\u002Fwwwroot\u002FHyperfApi\u003C\u002Fcode>\u003C\u002Fspan>），并解压。\u003Cbr>\u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>HyperfApi.zip\u003C\u002Fcode>\u003C\u002Fspan> \u003C\u002Fp>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002F4284bfb4113bfd0e9465b56d89cfc4b4.jpg\" alt=\"5\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Chr\u002F>\u003Cp>\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">5. 安装依赖包\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">进入解压后的项目目录，执行 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>composer install\u003C\u002Fcode>\u003C\u002Fspan> 安装依赖：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>cd \u002Fdata\u002Fwwwroot\u002FHyperfApicomposer install\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002Fadffbe98c901aecbdba2b1318b38e110.jpg\" alt=\"6\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">常见问题排查\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">\u003Cstrong>1. Composer 下载慢\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp style=\"text-align: start;\">可将源切换为国内镜像后再安装：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>composer config -g repos.packagist composer https:\u002F\u002Fmirrors.cloud.tencent.com\u002Fcomposer\u002F\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp style=\"text-align: start;\">\u003Cstrong>2. Composer 版本低\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp style=\"text-align: start;\">可将Composer更新后再安装：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>composer self-update\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp style=\"text-align: start;\">\u003Cstrong>3. Composer 依赖问题\u003C\u002Fstrong>\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>composer update\u003C\u002Fcode>\u003C\u002Fpre>\u003Chr\u002F>\u003Cp>\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">6. 启动并完成安装向导\u003C\u002Fh2>\u003Cp style=\"text-align: start;\">在项目目录命令行执行启动命令：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>cd \u002Fdata\u002Fwwwroot\u002FHyperfApiphp bin\u002Fhyperf.php start\u003C\u002Fcode>\u003C\u002Fpre>\u003Cblockquote style=\"text-align: start;\">注意：宝塔环境下默认的 php 命令未必是 8.2，若版本不符请使用完整路径，例如：\u002Fwww\u002Fserver\u002Fphp\u002F82\u002Fbin\u002Fphp bin\u002Fhyperf.php start\u003C\u002Fblockquote>\u003Cp style=\"text-align: start;\">启动成功后，浏览器访问：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>http:\u002F\u002F服务器IP:9501\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp style=\"text-align: start;\">进入安装向导页面，按提示填写\u003Cstrong>数据库 \u002F Redis \u002F 网站信息\u003C\u002Fstrong>完成配置。\u003C\u002Fp>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002F276ca64bdf8753302797c23d4ec086cf.jpg\" alt=\"7\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Cp style=\"text-align: start;\">安装完成后，回到启动服务的终端，按 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>Ctrl + C\u003C\u002Fcode>\u003C\u002Fspan> 终止 Hyperf 进程，准备进入正式部署。\u003C\u002Fp>\u003Cblockquote style=\"text-align: start;\">若访问不通，请检查：服务器安全组 \u002F 防火墙是否放行 9501 端口；启动终端是否有报错日志。\u003C\u002Fblockquote>\u003Chr\u002F>\u003Cp>\u003Cbr>\u003C\u002Fp>\u003Ch2 style=\"text-align: start;\">7. 生产环境部署\u003C\u002Fh2>\u003Ch3 style=\"text-align: start;\">7.1 使用 Supervisor 守护进程\u003C\u002Fh3>\u003Cp style=\"text-align: start;\">Hyperf 是常驻进程，需要使用 Supervisor 守护，确保异常退出后自动拉起、并随系统开机自启。\u003C\u002Fp>\u003Cp style=\"text-align: start;\">或使用 宝塔 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>进程守护管理\u003C\u002Fcode>\u003C\u002Fspan> 插件\u003C\u002Fp>\u003Cp style=\"text-align: start;\">\u003Cimg src=\"https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002F14925c969bbcd205a486d9251c11964a.jpg\" alt=\"8\" data-href=\"\" style=\"height: auto;\">\u003C\u002Fp>\u003Ch3 style=\"text-align: start;\">7.2 Nginx 反向代理\u003C\u002Fh3>\u003Cp style=\"text-align: start;\">Supervisor 配置完成、服务稳定运行在 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>127.0.0.1:9501\u003C\u002Fcode>\u003C\u002Fspan> 后，使用 Nginx 反向代理对外提供服务。在站点配置中加入：\u003C\u002Fp>\u003Cpre style=\"text-align: start;\">\u003Ccode>location \u002F {    proxy_http_version 1.1;    proxy_set_header Connection \"\";    proxy_set_header X-Real-IP $remote_addr;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    proxy_set_header Host $host;    proxy_pass http:\u002F\u002F127.0.0.1:9501;}\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp style=\"text-align: start;\">保存并重载 Nginx 后，即可通过域名正常访问。\u003C\u002Fp>\u003Cp style=\"text-align: start;\">至此，Hyperf 应用部署完成。后续更新代码后，记得通过 Supervisor 重启服务（如 \u003Cspan style=\"color: rgb(255, 60, 152); background-color: rgba(253, 153, 153, 0.2);\">\u003Ccode>supervisorctl restart 进程名\u003C\u002Fcode>\u003C\u002Fspan>）使变更生效。\u003C\u002Fp>","HyperfApi 安装部署教程（宝塔面板）","https:\u002F\u002Foss4liview.moji.com\u002Fthd_file\u002F2026\u002F06\u002F29\u002F276ca64bdf8753302797c23d4ec086cf.jpg","2026-06-28 16:04:16","本教程基于宝塔 \u002F aaPanel 面板演示如何从零部署一套 HyperfApi。Hyperf 是常驻内存、基于 Swoole 协程的 PHP 框架，运行机制和传统 PHP-FPM 项目差别较大，因此安装前需要对 PHP 环境做一些针对性配置，请按步骤操作。","宝塔、API、源码、Hyperf Api",6,"1",16,1,0,"已上架"]