DownloadTemplateController.class.php 947 Bytes
<?php
/**
 * 【后台】下载人员导入模板
 * DownloadTemplateController.class.php
 * @author:daijun
 * @date:2018-04-09
 */

namespace Frontend\Controller\Export;

class DownloadTemplateController extends \Common\Controller\Frontend\AbstractController
{

    protected $_require_login = false;

    public function Index()
    {

        // 下载员工导入模板
        $data_path = APP_PATH . 'Data' . D_S . 'User_import.xls';
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=员工导入模板.xls');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize($data_path));
        readfile($data_path);


        exit;
    }
}