How to create symlink from public/storage to storage/app/public in laravel?

后端 未结 5 986
悲&欢浪女
悲&欢浪女 2021-01-06 05:49

I have no idea on how to create symbolic link or symlink.

I am working on File system in laravel 5.2.

The document says th

5条回答
  •  Happy的楠姐
    2021-01-06 06:50

    On Shared Server, where one doesn't have ssh access to run php artisan storage:link this helps me run that from a controller, the if block code section can also be placed in a Service Provider as well as suggested by @shìpu-ahamed

    public function displayForm()
    {
    
            if(!file_exists(public_path('storage'))) {
               \App::make('files')->link(storage_path('app/public'), public_path('storage'));
        }
            return view('admin.index');
    }
    

提交回复
热议问题