2011-11-24 3 views
1

절약 된 .tar 파일을 다운로드하고 lib/php/src 폴더를 가져 와서 중고품으로 이름을 변경했습니다. 나는 그것을 실행하려 할 때, 내가 MyService 파일이없는 오류를 줄PHP 기반의 Thrift 클라이언트를위한 스 리프트 서비스

<?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(); 

: 다음 PHP 드리프트 클라이언트를 작성하는 내 PHP 파일에, 나는 다음과 같은 코드가 있습니다. 그리고 나는 그것이 맞지 않습니다. 나는 그 파일을 어디에서 얻을 수 있는지 또는 그러한 서비스를 작성하는 방법을 어디에서 알 수 있는지 알고 싶습니다. 나는 아파치 스 리프트에 정통하지 않기 때문에 그것을 묻습니다. 제가 잘못한 일을하고 있는지, 또는 서비스 파일을 작성하는 방법과 그 안에 무엇이 들어 있는지 알 수 있다면 알려주십시오. PHP Thrift 클라이언트를 작성하는 데 필요한 컴파일러가 있습니까?

내 질문에 시간을내어 주셔서 감사드립니다.

답변

4

는이 같은 MyService.php 뭔가를 얻기 위해 중고품 컴파일러 MyService.thrift IDL 파일을 컴파일해야합니다

thrift --gen php MyService.thrift

또한 this tutorial

에서 봐 주시기 바랍니다
관련 문제