从0到1 用宝塔集成虚拟主机提供商

前言 对比一般市场上的虚拟主机,宝塔都能兼容支持绝大多数的功能,并且宝塔有个比较大的特点为,页面上的接口均可以通过api请求,因此产生了这个想法定制出宝塔基础的虚拟主机 目标 前置条件 window server的主机 宝塔需安装在数据盘D盘上 正式内容 定义的配置文件 /data/vhost/baota.conf.json [ { "fchrServer":"flage", "host":"127.0.0.1", "key":"bt_api_key", "port":"8888", "mysql":"mysql_password", "sqlserver":"mssql_password", "region_id":"hk", "zone_id":"hk-02", "network":"bgp" } ] 封装好的交互php函数方法 class VhostBaotaClient implements VhostClientInterface { use ApiConfigTrait; use ApiLoggerTrait; private $client; private $key = ""; public $host = ""; private $port = "8888"; private $mssql_password = ""; /** * @var array 远端主机的状态转换 */ public $RemoteStatus = [ '1' => 'Running', '0' => 'Stopped', ]; public $IISRemoteStatus = [ 'Started' => 'Running', 'Stopped' => 'Stopped', ]; public static function getConfig() { return json_decode(file_get_contents('/data/vhost/baota....

八月 12, 2022 · 15 分钟 · Ken