代码拉取完成,页面将自动刷新
Tars-config is used to obtain the configuration delivered from the tars management platform. The usual usage scenario is to obtain the business configuration, such as mysql, redis address, port and other information
<?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 tars master address is configured here
$config->setModuleName("tedtest"); //The module name is used to display and report
$config->setCharsetName("UTF-8");
$conigServant = new \Tars\config\ConfigServant($config);
$result = $conigServant->loadConfig("PHPTest",'helloTars','hhh.txt',$configtext); //The parameters are appName (servant name first part), server name (servant name second part), file name, and the last one is a reference parameter, which is the output configuration file content.
var_dump($configtext);
$config->setSocketMode(2); //set socket model 1:socket, 2:swoole tcp client, 3:swoole coroutine client
$conigServant = new \Tars\config\ConfigServant($config);
$result = $conigServant->loadConfig("PHPTest",'helloTars','hhh.txt',$configtext);
var_dump($configtext);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。