我目前正处于Laravel的学习曲线中。
我想知道是否有办法使用Laravel中的Options -> Configuration
来访问来自另一个硬盘的文件(使用Windows)。
例如,我在驱动器C:上安装了Xrap和Laravel,但我想访问E:在网站目录之外的文件。我尝试过使用Storage::
和Storage::files('E:')
,但这显然不起作用。
提前致谢。
答案 0 :(得分:4)
我自己没有对此进行过测试,但是从文档页面开始,我需要将filesystem.php
配置文件编辑为:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'partitionE' => [
'driver' => 'local',
'root' => 'E:/', // not really sure about this
]
// the rest of it
];
然后访问
等文件Storage::disk('partitionE')->put('file.txt', 'Contents');
如果所有这些都失败了,您可以使用symlink
并在项目文件夹中创建指向E:
的链接。