我在使用php联盟的flysystem包时遇到了麻烦。 当我尝试使用数据库队列驱动程序将文件放入远程ftp服务器时,我将此错误作为return:
local.ERROR:异常'ErrorException',消息'未定义索引:000000000d1334030000000073b7555d'在C:... \ league \ flysystem \ src \ SafeStorage.php:30
只有数据库队列驱动程序才会发生!有没有人对此有任何线索?
我的代码是:
public function __construct()
{
$this->filesystem = new Filesystem(new SftpAdapter([
'host' => $host,
'port' => $port,
'username' => $username,
'password' => $password,
'root' => $root,
]));
}
public function ftp_put()
{
$this->filesystem->put('foo.txt', 'bar');
}
答案 0 :(得分:0)
我遇到了同样的问题。我发现你不能将文件系统作为Job中的参数推送到队列中,也不能在类构造函数中实例化文件系统。如果您使用进行put
调用的相同方法实例化文件系统,它对我来说就可以了。
public function __construct()
{
}
public function ftp_put()
{
$filesystem = new Filesystem(new SftpAdapter([
'host' => $host,
'port' => $port,
'username' => $username,
'password' => $password,
'root' => $root,
]));
$filesystem->put('foo.txt', 'bar');
}