1 Star 0 Fork 0

TarsCloud / TarsDocs_en

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
tars-config.md 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
ruanshudong 提交于 2020-03-03 21:26 . fix dir

tars-config document

Introduction

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

Instructions

<?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);
1
https://gitee.com/TarsCloud/TarsDocs_en.git
git@gitee.com:TarsCloud/TarsDocs_en.git
TarsCloud
TarsDocs_en
TarsDocs_en
master

搜索帮助