开发者

delete tab at the beginning of export CSV file

When I generate an export to a CSV file, I have a tab that is inserted at the beginning开发者_JS百科.

I don't understand why.

Here is my code :

public function hookExportAll($params){


        header('Content-Type: application/csv');
        header('Content-Disposition: inline; filename="clients.csv"');
        header('Cache-Control: private, max-age=0, must-revalidate');

        //mysql request
        $sql = "..."
        $clientlist = Db::getInstance()->ExecuteS($sql);

                    //separator recovered the post of the form 
        $filter['sep']=Tools::getValue('sep');
        //; or , or \t

        $entete = array('email','nom','prenom','anniversaire','newsletter','adresse','pays','téléphone');

        echo $this->getcsvline($entete, $sep);

        foreach($clientlist AS $client){
            echo $this->getcsvline($client, $sep);
        }

}

private function getcsvline($list, $sep="\t"){  
    return implode($sep, $list)."\r\n";
}

A little help?


Finally, Ivar Bonsaksen must be right. A tab must have been generated in the CMS Prestashop before a . With no time to dwell on this case, I consider this issue as resolved.

Thank you all for your support, see you soon =)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜