phptars / tars-config
该包的最新版本(0.1.6)没有提供许可信息。
tars配置拉取
0.1.6
2018-12-25 06:19 UTC
Requires
- php: >=5.3
- phptars/tars-client: ~0.1
This package is auto-updated.
Last update: 2024-09-15 20:53:28 UTC
README
简要介绍
tar配置用于获取tar管理平台分发的配置。通常使用与部署环境对应的业务配置,如mysql、redis地址、端口等信息
使用说明
<?php
require_once "../vendor/autoload.php";
$config = new \Tars\client\CommunicatorConfig();
$config->setLocator("tars.tarsregistry.QueryObj@tcp -h 172.16.0.161 -p 17890"); //The configuration here is the tar master address
$config->setModuleName("tedtest"); //The primary call name is used to display the secondary primary call report.
$config->setCharsetName("UTF-8"); //character set
$conigServant = new \Tars\config\ConfigServant($config);
$result = $conigServant->loadConfig("PHPTest",'helloTars','hhh.txt',$configtext); //The parameters are appName (service name part I), server name (service name part II), file name, and the last is reference parameter, which is the content of the output configuration file.
var_dump($configtext);
$config->setSocketMode(2); // setup socket model为2 swoole tcp client,1为socket,3为swoole protocol client
$conigServant = new \Tars\config\ConfigServant($config);
$result = $conigServant->loadConfig("PHPTest",'helloTars','hhh.txt',$configtext);
var_dump($configtext);