我正在关注laravel中的post文件系统。 我在ubuntu 16.10中运行版本5.4。
这就是我在控制器中的内容 - 仅用于测试:
use File;
...
public function dbIni() {
$filename="../../../storage/brUf";
$content = File::get($filename);
foreach($content as $line) {
echo $line;
}
}
内部存储我有一个 brUf 文件。
当我尝试运行此代码时,这就是我得到的:
FileNotFoundException in Filesystem.php line 41:
File does not exist at path ../../../storage/brUf
这条道路我错过了什么?
答案 0 :(得分:1)
您需要使用名为storage_path()
所以
public function dbIni() {
$filename=storage_path("brUf");
$content = File::get($filename);
foreach($content as $line) {
echo $line;
}
}