thrift .tar ファイルをダウンロードし、 lib/php/src フォルダーを取得して、名前を thrift に変更しました。次に、PHP Thrift Client を書き込むための PHP ファイルに、次のコードがあります。
<?php
$GLOBALS['THRIFT_ROOT'] = 'thrift';
require_once 'thrift/Thrift.php';
require_once 'thrift/transport/TTransport.php';
require_once 'thrift/transport/TSocket.php';
require_once 'thrift/protocol/TBinaryProtocol.php';
require_once 'thrift/transport/TFramedTransport.php';
require_once 'thrift/transport/TBufferedTransport.php';
require_once 'thrift/packages/MyService/MyService.php';
require_once 'thrift/packages/MyService/MyService_types.php';
$transport = new TSocket('localhost',1100);
$transport->open();
$protocol = new TBinaryProtocol($transport);
$client= new MyServiceClient($protocol, $protocol);
$result = $client->operation('param1', 'param2');
Print 'result = ' . $result;
$transport->close();
実行しようとすると、ファイルがないというエラーが表示されMyService
ます。そして、私がそれを持っていないのは正しいです。そのファイルをどこから入手できるか、またはそのようなサービスの書き方をどこから知ることができるかを知りたいです。私はApache Thriftに精通していないので、それを求めています。私が何か間違ったことをしているのか、サービスファイルを書く方法とその内容を誰かが知っているかどうか教えてください。PHP Thriftクライアントを書くだけで、ある種のコンパイラが必要になりますか?
私の質問に時間を割いていただきありがとうございます。