美文网首页
php 导出txt文件

php 导出txt文件

作者: 莫奈的有趣灵魂 | 来源:发表于2023-06-11 16:32 被阅读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");
        }

相关文章

网友评论

      本文标题:php 导出txt文件

      本文链接:https://www.haomeiwen.com/subject/astfydtx.html