[英]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.