php 导出txt文件

2023-06-11  本文已影响0人  莫奈的有趣灵魂
        $filename = "linkkeyword.txt";
        $filename = iconv("UTF-8","GBK",$filename);
        header("Content-type:application/octet-stream");
        header("Accept-Ranges:bytes");
        header("Content-Disposition:attachment;   filename={$filename}");
        header("Expires:0");
        header("Cache-Control:must-revalidate,post-check=0,pre-check=0");
        header("Pragma:public");
        $list = Db::name('weapp_linkkeyword')->select();
        foreach ($list as $k => $v){
            echo iconv("UTF-8",'GB2312//IGNORE',"{$v['title']}={$v['url']}\r\n");
        }
上一篇下一篇

猜你喜欢

热点阅读