问题
I have the following codes. I have checked the files and they exist.
require_once "/usr/lib/php/Thrift/ClassLoader/ThriftClassLoader.php";
use Thrift\ClassLoader\ThriftClassLoader;
$GEN_PHP = __DIR__ . "/gen-php/";
$loader = new ThriftClassLoader();
$loader->registerNamespace("Thrift", "/usr/lib/php/");
$loader->registerDefinition("hello", $GEN_PHP);
$loader->register();
use Thrift\Protocol\TBinaryProtocol;
use Thrift\Transport\TPhpStream;
use Thrift\Transport\TBufferedTransport;
class HelloWorldHandler implements \hello\HelloPrinterIf {
...
};
However, I'm getting the following error when I ran.
PHP Fatal error: Interface 'hello\HelloPrinterIf' not found in /home/admin/Desktop/thrift-test/php-server.php
I think it has something to do with ThriftClassLoader not loading hello
definition.
Please let me know what I did wrong.
Thanks.
来源:https://stackoverflow.com/questions/37383646/apache-thrift-not-loading-php-definition