我的视图文件夹中有一个 sitemap.xml 文件,这是路线:
Route::get('sitemap.xml',function() {
return response()->view('sitemap')
->header('Content-Type', 'xml');
});
Run Code Online (Sandbox Code Playgroud)
但是当我搜索 mydomainname.com/sitemap.xml 时。它返回InvalidArgumentException 查看 [sitemap] 未找到。
我尝试在 google 和 youtube 上搜索,但找不到任何解决方案。
我正在尝试在 Laravel 中导入 Excel 数据并插入到数据库中。我正在使用 maatwebsite/excel 版本 3 作曲家包。
错误:未定义索引:customer_name
刀片文件:import_excel.blade.php
<form method="post" enctype="multipart/form-data" action="{{ url('/import_excel/import') }}">
{{ csrf_field() }}
<div class="form-group">
<table class="table">
<tr>
<td width="40%" align="right"><label>Select File for Upload</label></td>
<td width="30">
<input type="file" name="select_file" />
</td>
<td width="30%" align="left">
<input type="submit" name="upload" class="btn btn-primary" value="Upload">
</td>
</tr>
<tr>
<td width="40%" align="right"></td>
<td width="30"><span class="text-muted">.xls, .xslx</span></td>
<td width="30%" align="left"></td>
</tr>
</table>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
导入文件:CustomerImport.php
public function model(array $row)
{
$data = [];
foreach ($row as $value)
{
$data[] = …Run Code Online (Sandbox Code Playgroud)