PHP code example of phptars / tars-assistant
1. Go to this page and download the library: Download phptars/tars-assistant library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phptars / tars-assistant example snippets
"";// taf服务ip
$port = 0;// taf服务端口
$hello = new \TestApp\HelloServer\HelloObj\Hello($ip,$port);
// 或使用主控寻址
$_SERVER['LOCATOR_IP'] = "172.16.0.161";
$_SERVER['LOCATOR_PORT'] = 17890;
// 无需指定ip和端口
$hello = new \TestApp\HelloServer\HelloObj\Hello();
try {
$hello->testHello("test",$rsp);
var_dump($rsp);
}
catch(phptars\TarsException $e) {
// 错误处理
}