Heim >Backend-Entwicklung >PHP-Tutorial >Verwendung von Excel in Laravel5

Verwendung von Excel in Laravel5

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:11:581271Durchsuche

http://www.maatwebsite.nl/laravel-excel/docs/getting-started
https://packagist.org/packages/maatwebsite/excel

Herunterladen

laravel5 中使用excel
Komponisten aktualisieren
Oder konfigurieren Sie

<code>composer <span><strong>require</strong></span> maatwebsite/excel</code>

2 direkt in der Befehlszeile

app/config/app.php
Fügen Sie
zum Provider-Array hinzu MaatwebsiteExcelExcelServiceProvider::class,
Zum Aliases-Array hinzufügen:
„Excel“ => MaatwebsiteExcelFacadesExcel::class,

3. Verwenden Sie

<code><span><span><?php</span><span>namespace</span><span>App</span>\<span>Http</span>\<span>Controllers</span>;

<span>use</span><span>Illuminate</span>\<span>Http</span>\<span>Request</span>;

<span>use</span><span>App</span>\<span>Http</span>\<span>Requests</span>;
<span>use</span><span>App</span>\<span>Http</span>\<span>Controllers</span>\<span>Controller</span>;
<span>use</span><span>Maatwebsite</span>\<span>Excel</span>\<span>Facades</span>\<span>Excel</span>;

<span><span>class</span><span>DemoController</span><span>extends</span><span>Controller</span>
{</span><span>public</span><span><span>function</span><span>getDemo</span><span>()</span>{</span><span>return</span> view(<span>"demo.demo"</span>);

    }
    <span>public</span><span><span>function</span><span>getExcel</span><span>()</span>{</span><span>// $excel = App::make('excel');</span>
        Excel::create(<span>'Laravel Excel'</span>, <span><span>function</span><span>(<span>$excel</span>)</span> {</span><span>$excel</span>->sheet(<span>'Excel sheet'</span>, <span><span>function</span><span>(<span>$sheet</span>)</span> {</span><span>$sheet</span>->setOrientation(<span>'landscape'</span>);

            });

        })->export(<span>'xls'</span>);
    }
}
</span></span></code>

, um die Excel-API-Adresse
zu exportieren http://www.maatwebsite.nl/laravel-excel/docs/export
Importieren Sie die Excel-API-Adresse
http://www.maatwebsite.nl/laravel-excel/docs/import

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

Das Obige stellt die Verwendung von Excel in Laravel5 vor, einschließlich der erforderlichen Inhalte. Ich hoffe, dass es für Freunde hilfreich ist, die sich für PHP-Tutorials interessieren.

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn