Php 如何在公用文件夹Laravel 5.1上输出文件

Php 如何在公用文件夹Laravel 5.1上输出文件,php,laravel,laravel-5.1,Php,Laravel,Laravel 5.1,我有debian机器,我的站点位于/var/www/laravel site/folder中。 在laravel站点文件夹中,我有文件和公用文件夹。如何将文件输出到文件夹以防止文件被网络读取?我想base\u path()会有帮助 简单用法示例: <?php $file = base_path('FILES').'/people.txt'; // Open the file to get existing content $current = file_get_co

我有debian机器,我的站点位于/var/www/laravel site/folder中。 在laravel站点文件夹中,我有文件和公用文件夹。如何将文件输出到文件夹以防止文件被网络读取?

我想
base\u path()
会有帮助

简单用法示例:

<?php
    $file = base_path('FILES').'/people.txt';
    // Open the file to get existing content
    $current = file_get_contents($file);
    // Append a new person to the file
    $current .= "John Smith\n";
    // Write the contents back to the file
    file_put_contents($file, $current);
?>
因此,要获取您的
/var/www/laravel站点
文件夹,只需使用
echo base_path()

要获取
文件
文件夹(或Laravel基地内所需的任何路径),请使用
echo基地路径(“文件”)
它将输出
/var/www/laravel site/FILES

我想
base\u path()
会有帮助

简单用法示例:

<?php
    $file = base_path('FILES').'/people.txt';
    // Open the file to get existing content
    $current = file_get_contents($file);
    // Append a new person to the file
    $current .= "John Smith\n";
    // Write the contents back to the file
    file_put_contents($file, $current);
?>
因此,要获取您的
/var/www/laravel站点
文件夹,只需使用
echo base_path()

要获取
文件
文件夹(或Laravel基地内所需的任何路径),请使用
echo基地路径(“文件”)
它将输出
/var/www/laravel site/FILES