duanchen1937 2018-08-14 17:13 采纳率: 0%
浏览 136

致命错误:未捕获错误:未找到类'EthereumRPC \ EthereumRPC'

I've been playing with this for hours now, finding all kind of autoloaders but I can't figure it out:

declare(strict_types=1);

function __autoload($class_name) 
{
    //class directories
    $directorys = array(
        'EthereumRPC/',
        'EthereumRPC/API/',
        'EthereumRPC/API/Personal/',
        'EthereumRPC/Contracts/',
        'EthereumRPC/Contracts/ABI/',
        'EthereumRPC/Exception/',
        'EthereumRPC/Response/',
        'ERC20/',
        'ERC20/data/',
        'ERC20/Exception/'
    );

    //for each directory
    foreach($directorys as $directory)
    {
        //see if the file exsists
        if(file_exists($directory.$class_name . '.php'))
        {
            require_once($directory.$class_name . '.php');
            //only require the class once, so quit after to save effort (if you got more, then name them something else 
            return;
        }            
    }
}

use EthereumRPC\EthereumRPC;
use ERC20\ERC20;

I load every directory that contains classes but I still end up with the error:

Fatal error: Uncaught Error: Class 'EthereumRPC\EthereumRPC' not found in /home/sewicumg/public_html/contenthourlies.com/wp-content/themes/seoexp/account_client.php:62

The instruction file said to only include the two lines at the bottom but that definitely didn't work.

Am I missing something?

Here is the code that uses the classes:

$geth = new EthereumRPC('127.0.0.1', 8545);
$erc20 = new ERC20($geth);

All those EthereumRPC and ERC20 folders are in the same directory as the php file that this code is in.

Am I missing something here?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何实验stm32主通道和互补通道独立输出
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题