【问题标题】:JSON-RPC PHP class not found errorJSON-RPC PHP 类未找到错误
【发布时间】:2016-06-13 21:28:56
【问题描述】:

我在一个 php 文件中为多链的 json rpc api 使用这个 php 包装器:https://github.com/Kunstmaan/libphp-multichain

我不确定我应该如何调整我的代码并且我不愿意调整库,所以我想检查一下这种理解:

<?php
   require_once 'libphp-multichain/src/be/kunstmaan/multichain/MultichainClient.php';
   require_once 'libphp-multichain/src/be/kunstmaan/multichain/MultichainHelper.php';
   $client = new MultichainClient("http://107.170.46.124:port",{usr},{pwd});
   print_r($client);

我在 apache 错误日志中看到的错误是:

PHP 致命错误:在第 5 行的 /var/www/html/new.php 中找不到类“MultichainClient”

以前我在这里有一个错误的问题,它指的是一个将 MultichainClient 视为函数的 php 错误

【问题讨论】:

  • 你忘了new所以$client = new MultichainClient(...);

标签: php class json-rpc


【解决方案1】:

这不是一个函数,您正在尝试声明一个new 类对象的实例。所以添加new关键字

$client = new MultichainClient("multichainrpc","password","host","port",3);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    相关资源
    最近更新 更多