zoukankan      html  css  js  c++  java
  • thrift的php-v0.12版本类自动加载失败

    参考网上教程,使用$loader->registerDefinition('Sample', $GEN_DIR); 但是会报PHP Fatal error:  Uncaught Error: Class 'SampleformatDataClient' not found in /Users/work/local/gopath/src/rpc/phprpc-client.php:32。也就是类加载失败啦。原因应该是因为php-v0.12版本使用的PSR-4 记载规范。并且提示使用$thriftClassLoader->registerNamespace('namespace', '<path>') 而不是 u$thriftClassLoader->registerDefinition('namespace', '<path>').

    使用php的thrift,有两点需要注意:

    1.需要将thrift/lib/php/*中的内容复制到自己定义的thrift的库目录,如phplib中,然后将子目录lib改成Thrift,否则会报错。因为是ClassLoader/ThriftClassLoader.php的152行地方的namespace是以Thrift开头的。

    2.上面提到的服务也要用$loader->registerNamespace('Sample', $dir)

  • 相关阅读:
    初学flask
    第一次使用pyqt5解决的几个小问题
    一些细节
    关于random
    go语言 方法
    go 语言 struct 另类构造函数 继承
    go 语言 链表 的增删改查
    go 语言 链表
    go 语言struct
    无题
  • 原文地址:https://www.cnblogs.com/chengsheng/p/11990718.html
Copyright © 2011-2022 走看看