Codeigniter生成文本视图

问题描述 投票:0回答:1

我需要生成数据的文本视图,但有些链接工作正常但有些链接没有显示为文本。

我的代码如下:

            $cidr_result    = $this->webmodel_downloads->singlecountrycidr($country_code2);
        //$this->load->helper('text');
        //$this->load->helper('file');
        //echo "# Generated ". date('Y-m-d')."\n";
        $this->output->set_content_type('text/plain', 'UTF-8');
        $this->output->set_header("Content-Type: text/plain");
        echo "# Generated ". date('Y-m-d').PHP_EOL;
        if (!empty($cidr_result)){
            foreach($cidr_result as $row){
            echo $row['value'].PHP_EOL;
            //print_r($row['value'].PHP_EOL);
            }
        }

如果我犯了一些错误,请帮助我。谢谢

codeigniter
1个回答
0
投票

我不知道这背后的技术原因,但我没有使用CodeIgniter函数作为文本标题,而是使用了PHP Header,它运行良好;

header ("Content-type: text/plain");
© www.soinside.com 2019 - 2024. All rights reserved.