简体   繁体   English

Laravel 5.6 存储链接已存在,但尝试从公用文件夹获取文件时出现 404 错误

[英]Laravel 5.6 storage link already exists but i am getting 404 error when trying to get a file from the public folder

I've created a symlink using the command:我使用以下命令创建了一个符号链接:

php artisan storage:link

Then I've created a file in storage/app/public .然后我在storage/app/public创建了一个文件。 Following the documentation, I could get the link to this file with:按照文档,我可以通过以下方式获取此文件的链接:

asset('storage/file.txt')

Which returns in the html code:在 html 代码中返回:

http://127.0.0.1:8000/storage/psps.txt

But I am getting 404 error.但我收到 404 错误。 Any help?有什么帮助吗?

Go to your project's public folder, and delete the storage folder, if it exists.转到项目的public ,并删除storage文件夹(如果存在)。
Then run this command line:然后运行这个命令行:

php artisan storage:link

Go to the project root and copy and paste this two command转到项目根目录并复制并粘贴这两个命令

rm -rf public/storage
php artisan storage:link

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel 5.6:公用文件夹中已下载文件的副本 - Laravel 5.6: Copy of downloaded file in public folder 我正在尝试将图像文件上传到公共存储,为此 laravel 8 Instagram 克隆项目,但它拒绝 - I am trying to upload an image file to the public storage, for this laravel 8 Instagram clone project but it is refusing 如何在Laravel上的公共存储链接中显示用户文件夹中的图像 - How to display images from user folder in public storage link on laravel 我在 laravel 网站中收到错误 404 - I am getting error 404 in laravel website 我将使用 laravel 5.6,安装 composer 时出现此错误,我该怎么办? - I am going to work with laravel 5.6 and I get this error when installing composer, what can I do? 尝试创建 symfony 文件夹时出现错误 - I am getting error when trying to create symfony folder Laravel 中存储子文件夹中图片的公共链接 - Public link for a picture in storage sub folder in Laravel Laravel 6 尝试获取文件时存储导致 404 错误 - Laravel 6 Storage results in a 404 error when trying to fetch files 当我尝试重定向到laravel 5.6中的另一个页面时,出现类似“抱歉,找不到您要搜索的页面”的错误。 - when i am try to redirect to another page in laravel 5.6 then getting error like “Sorry, the page you are looking for could not be found.” 无法从 Laravel 5.6 的公用文件夹下载文件 - Can't download files from public folder from Laravel 5.6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM