首页 > 解决方案 > mkdir():在 IIS8 上的 laravel 上导出 Excel 文件时文件存在

问题描述

我正在尝试使用 maatwebsite/Excel 包从 laravel 导出 Excel 文件,并且在本地一切正常,但是当我想将它放在 IIS 服务器上时,出现此错误: 在此处输入图像描述

这是导致我的控制器中错误的代码:

$date = Carbon::now()->format("d-m-y-h-m-s");
$data1= json_decode( json_encode($data), true);
$export = new ExcelExport((array) $data1);
$file= Excel::store($export,storage_path('app')."\jobshistorie".$date.".xlsx", "local");

我将整个项目目录的权限授予了服务器。我在公共目录中也有 web.config 文件:

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
          <rules>
            <rule name="Rule 1" stopProcessing="true">
              <match url="^(.*)/$" ignoreCase="false" />
              <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
            </rule>
            <rule name="Rule 2" stopProcessing="true">
              <match url="^" ignoreCase="false" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
              </conditions>
              <action type="Rewrite" url="index.php" />
            </rule>
          </rules>
        </rewrite>
    </system.webServer>
</configuration>

我可以使用我能得到的所有帮助,谢谢!

标签: laraveliis-8php-7.2maatwebsite-excel

解决方案


我想我迟到了,但你可以尝试清除缓存: php artisan config:cachephp artisan config:clear

希望它可能会有所帮助。


推荐阅读