[英]Thrift 0.9 PHP server missing Processor
我正在編寫一個通過Thrift進行通信的應用程序。 我正在使用Thrift 0.9.0(在OSX上通過自制軟件安裝)。 我有一個工作的Java服務器和客戶端,但我正在努力編寫PHP服務器,因為沒有生成* Processor類。
Thrift的PHP文檔基本上不存在 ,但我期望生成* Processor類,因為:
但是,當我從tutorial.thrift文件( thrift -r --gen php:namespace tutorial.thrift
)生成PHP代碼時,生成的Calculator.php不包含CalculatorProcessor類。
我錯過了什么嗎?
寫這個問題的過程促使我找到答案!
我正在生成php:namespace
,但這是使用Thrift 0.8.0的延續。 實際上,0.8中不存在“命名空間”(大概是因為命名空間總是添加到0.9中生成的PHP)。 thrift --help
的輸出列出了php:server
,它“生成PHP服務器存根”。 這顯然意味着生成PHP * Processor類。
我有一個非常類似的應用程序(Java Server with PHP Client)。
我有以下thrift定義文件:
namespace java com.blogspot.symfonyworld.wealthylaughingduck.thrift.generated
namespace php SymfonyWorld.WealthyLaughingDuck
# definitions below
然后我運行以下命令來重新生成thrift類:
thrift -r --gen java -out src/main/java src/submodules/commons/thrift/service.thrift
thrift -r --gen php:oop,namespace,autoload -out src/main/php/packages src/submodules/commons/thrift/service.thrift
它就像一個魅力:)看看我的github應用程序 - 它開箱即用(您可以在界面中單擊時觀看Java log4j輸出)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.