我有一个附加域xyz。在内部public_html中作为“public_html/xyz”。并在xyz内上传了一个laravel项目。在里面但是,当我使用存储链接上载文件时,文件不会保存在公用文件夹中,而图像会保存在存储文件夹中。我正在以下路径中保存图像
存储/应用/公共/图像/
这是我的htaccess文件。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
这是我的网站。php文件内部路由。
Route::get('/clear-cache', function() {
$run = Artisan::call('config:clear');
$run = Artisan::call('cache:clear');
$run = Artisan::call('config:cache');
return 'FINISHED';
});
Artisan::call('storage:link');
Route::get('/', 'frontController@index')->name('homepage');
你可以使用我一直使用的符号链接代码。
<?php
$target = '/home/public_html/xyz/storage/app/public';
$link = '/home/public_html/xyz/storage';
symlink($target, $link);
echo 'Symlink done!';
您可以在public_html/xyz/Public
中创建一个symlink.php
文件,然后转到链接。
示例:http://www.xyx.com/symlink.php
**不要忘记删除这个文件后,你从链接存储文件夹完成。