我是PHP的新手,我试图在mac上运行web3.php中的$exampleBase.php
但它一直显示错误:
PHP致命错误:未捕获错误:在/Users/hsnl/Desktop/code/back-end-php/web3.php/examples/exampleBase.php:7中找不到类'Web3 \ Web3'。堆栈跟踪:#0 {main}在第4行的/Users/hsnl/Desktop/code/back-end-php/web3.php/examples/exampleBase.php中引发
$exampleBase.php
文件是这样的
<?php
require('vendor/autoload.php');
use Web3\Web3;
$web3 = new Web3('http://localhost:8545/');
知道为什么或如何解决这个问题?
如果您尝试运行sc0Vu,请尝试按照以下步骤操作:https://github.com/sc0Vu/web3.php#local-php-cli-installed
克隆仓库并安装包。
git clone https://github.com/sc0Vu/web3.php.git && cd web3.php && composer install
这意味着:
运行测试脚本。
vendor/bin/phpunit