您的位置首页百科问答

thrift

thrift

的有关信息介绍如下:

thrift

//Student.thrift

namespace php Student

service Student{

string getStuName()

}

执行thrift --gen php ./Student.thrift 在gen-php下有两个文件。

其中Student.php

namespace Student;

/**

* Autogenerated by Thrift Compiler (0.9.1)

*

* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

* @generated

*/

use Thrift\Base\TBase;

use Thrift\Type\TType;

use Thrift\Type\TMessageType;

use Thrift\Exception\TException;

use Thrift\Exception\TProtocolException;

use Thrift\Protocol\TProtocol;

use Thrift\Protocol\TBinaryProtocolAccelerated;

use Thrift\Exception\TApplicationException;

interface StudentIf {

public function getStuName();

}

class StudentClient implements \Student\StudentIf {

protected $input_ = null;

protected $output_ = null;

protected $seqid_ = 0;

public function __construct($input, $output=null) {

$this->input_ = $input;

$this->output_ = $output ? $output : $input;

}

public function getStuName()

{

$this->send_getStuName();

return $this->recv_getStuName();

}

public function send_getStuName()

{

$args = new \Student\Student_getStuName_args();

$bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');

if ($bin_accel)

{

thrift_protocol_write_binary($this->output_, 'getStuName', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());

}