为什么Excel文件格式错误?

时间:2015-10-06 11:21:52

标签: php html excel http laravel

档案:http://www.filedropper.com/users_1 为什么我不能正常打开?

当你打开文件时,我看到一堆晦涩难懂的字符,即使编码是正常的

我使用laravel 5和laravel excel。 laravel excel:http://www.maatwebsite.nl/laravel-excel/docs

Excel::create('users', function($excel) {
                $excel->sheet('sheet', function($sheet) {
                    $admin = App\User::find(200000);
                    $clients = App\User::getUserClientsIdAll( $admin->id );
                    $sheet->loadView('admin.excel.users', [
                        'user' => $admin,
                        'clients' => $clients, 
                        'isAdmin' => true
                    ]);
                });
            })->export($format);

查看" admin.excel.users":

<html>
    <table>
        <tbody>
            <tr>
                <td width="100">
                    № {{  $num                                    }}</td>
                <td width="100">
                    Имя: {{  $info->data_name                      }}</td>
                <td width="100">
                    id: {{  $info->id                              }}</td>
                <td width="100">
                    Расч. счет: {{  $info->checkingAccount         }}</td>
                <td width="100">
                    Сумма депоз: {{  $info->data_depositsSum       }}</td>
                <td width="100">
                    Город: {{  $info->city                         }}</td>
                <td width="100">
                    Область: {{  $info->area['NAZVA']              }}</td>
                <td width="100">
                    Структ: {{  $info->data_treeCount              }}</td>
            </tr>
        </tbody>
    </table>
</html>

回复标题:

Cache-Control:cache, must-revalidate
Connection:Keep-Alive
Content-Disposition:attachment; filename="users.xls"
Content-Encoding:gzip
Content-Length:1014
Content-Type:application/vnd.ms-excel; charset=UTF-8
Date:Tue, 06 Oct 2015 12:21:00 GMT
Expires:Mon, 26 Jul 1997 05:00:00 GMT
Keep-Alive:timeout=1, max=100
Last-Modified:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:public
Server:Apache/2
Vary:Accept-Encoding,User-Agent
X-Powered-By:PHP/5.6.13

请求标题:

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Host:depozit.cash
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

帮帮我。

0 个答案:

没有答案