我尝试为Local
适配器运行 Flysystem 的基本示例代码并得到一个Class 'League\Flysystem\Adapter\Local' not found
错误。这是我的过程:
版本检查:
php -v
PHP 5.5.9-1ubuntu4.23 (cli) (built: Feb 8 2018 21:59:47)
安装飞行系统:
composer require league/flysystem
输出显示我是最新的(这是我第二次运行它):
Using version ^1.0 for league/flysystem
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
现在vendor
web 根目录中有一个文件夹。里面./web/vendor/league/flysystem/src/Adapter$
有这些文件:
AbstractAdapter.php
AbstractFtpAdapter.php
CanOverwriteFiles.php
Ftpd.php
Ftp.php
Local.php
NullAdapter.php
Polyfill/
SynologyFtp.php
...只是显示它似乎安装正确(?)我在我的 web 根目录中创建了一个测试文件和一个测试目录:
- fly-local.php
- 我的文件/
fly-local.php
我将他们文档中的文本粘贴到其中(https://flysystem.thephpleague.com/docs/adapter/local/ ):
<?php
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
$adapter = new League\Flysystem\Adapter\Local(__DIR__.'/myfiles');
$filesystem = new Filesystem($adapter);
...并将适配器的根文件夹更改为myfiles
(正确吗?)。然后我运行它:
php fly-local.php
它输出:
PHP Fatal error: Class 'League\Flysystem\Adapter\Local' not found in /[PROJECT DIR]/web/fly-local.php on line 6
PHP Stack trace:
PHP 1. {main}() /[PROJECT DIR]/web/fly-local.php:0
我究竟做错了什么?