codeIgniter使用thrift

最近在研究thrift,但网上没有一个完整可用的整合代码来参考。估计thrift在php圈内还不多见。github传送门

  1. 先把Thrift库放在application/libraries/下;
  2. idl的定义在根目录下的idl里面;
  3. 安装thfit http://thrift.apache.org/docs/install/centos
  4. 修改ci/system/core/CodeIgniter.php:401;
  5. 基类ci/application/code/MY_Controller.php,处理thrift的请求;
  6. demo控制器ci/application/controllers/test.php;
  7. 访问http://127.0.0.1/PhpClient.php来发起thrift请求,注意修改PhpClient.php里面的请求地址。(参考结果:service\test\testResp Object ( [header] => [age] => 33 ))

修改PhpClient.php地址为PhpServer.php也是能跑通的。

Posted in : php


2 thoughts on “codeIgniter使用thrift

  1. 杭州家政网说道:

    值得思考哦,受教了!

    1. xuchunhua说道:

      共勉

发表评论

电子邮件地址不会被公开。 必填项已用*标注