背景

正在跟着文档学习文件存储模块,这里需要在配置文件filesystems设置自己想要的软连接

    /*
    |--------------------------------------------------------------------------
    | Symbolic Links
    |--------------------------------------------------------------------------
    |
    | Here you may configure the symbolic links that will be created when the
    | `storage:link` Artisan command is executed. The array keys should be
    | the locations of the links and the values should be their targets.
    |
    */

    'links' => [
        public_path('storage') => storage_path('app/public'),
    ],

在这里插入图片描述

如文档所示:配置好以后,需要执行

  • php artisan storage:link
    软连接才能生效;

问题

但是我执行上述命令后,提示symlink (): Protocol error,这里让我想到的是,我本地安装的是homestead,不知道不是配置的问题,打开文档重新看一下;
在文档最后一步写着如下:在这里插入图片描述
于是,我就复制了这段配置,但是我重新进入虚拟机以后,执行php artisan 命令,还是提示symlink (): Protocol error,即使加上sudo也还是这个错误,我这时候就开始百度了;

有人建议使用CMD的管理员身份去执行,就可以了;

结果

所以:

1、退出homestead并关闭vagrant
1、exit
2、vagrant halt

在这里插入图片描述

2、管理员进入CMD,然后进入虚拟机

在这里插入图片描述
然后执行php artisan命令:
在这里插入图片描述
显示执行成功,这时候我就可以直接访问storage目录下,上传的图片了;访问成功!!!
在这里插入图片描述

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐