php - 致命错误:未捕获的错误:找不到类“EthereumRPC\EthereumRPC”
问题描述
我已经玩了几个小时了,找到了各种自动加载器,但我想不通:
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;
我加载了每个包含类的目录,但仍然出现错误:
致命错误:未捕获的错误:在 /home/sewicumg/public_html/contenthourlies.com/wp-content/themes/seoexp/account_client.php:62 中找不到类“EthereumRPC\EthereumRPC”
说明文件说只包括底部的两行,但这绝对行不通。
我错过了什么吗?
这是使用这些类的代码:
$geth = new EthereumRPC('127.0.0.1', 8545);
$erc20 = new ERC20($geth);
所有这些 EthereumRPC 和 ERC20 文件夹都与此代码所在的 php 文件位于同一目录中。
我在这里错过了什么吗?
解决方案
推荐阅读
- javascript - 在 javascript 中使用带有嵌套元素的 map\reduce
- c# - c#可以通过串口发送数据但不能接收
- linux - 如何自动登录 Linux 服务器并在网站上运行 git fetch/pull?
- sql - SQLite 在一行中返回多行
- pdf - 是否有任何 pdf 工具或 git 项目可以将 pdf 免费注释转换为文本注释?
- android - 在 Android 中以编程方式打开“添加 WiFi 网络”屏幕
- python - Pandas Apply/Lambda 返回数据框而不是单行
- flutter - 用颤振在社交媒体上发布链接后如何获得成功?
- javascript - JavaScripts 参数选项
- augmented-reality - ARCore – 来自后置 Android 深度摄像头的原始深度数据