composer require metowolf/meting
cd .config/composer/vendor/metowolf
debian@MiWiFi-R3-srv:~/.config/composer/vendor/metowolf$ tree
.
└── meting
├── composer.json
├── LICENSE
├── README.md
└── src
└── Meting.php
2 directories, 4 files
我想使用Meting.php,github上的文档这样写:
use MetowolfMeting;
$api = new Meting('netease');
$data = $api->format(true)->search('Soldier');
我这样写
cd /home/debian/.config/composer/vendor
php -a
php > include('metowolf/meting/src/Meting.php');
php > use MetowolfMeting;
php > $api = new Meting('netease');
PHP Warning: Uncaught Error: Class 'Meting' not found in php shell code:1
Stack trace:
#0 {main}
thrown in php shell code on line 1
请问,如何解决?
php > echo __DIR__;
/home/debian/.config/composer/vendor/metowolf
php > require __DIR__ . '/../vendor/autoload.php';
PHP Warning: require(/home/debian/.config/composer/vendor/metowolf/../vendor/autoload.php): failed to open stream: No such file or directory in php shell code on line 1
PHP Fatal error: require(): Failed opening required '/home/debian/.config/composer/vendor/metowolf/../vendor/autoload.php' (include_path='.:/usr/share/php') in php shell code on line 1
来个笨办法
php > require '/home/debian/.config/composer/vendor/autoload.php';
php > use MetowolfMeting;
php > $api = new Meting('netease');
PHP Warning: Uncaught Error: Class 'Meting' not found in php shell code:1
Stack trace:
#0 {main}
thrown in php shell code on line 1
还是不行