How to remove multiple UTF-8 BOM sequences

后端 未结 11 1956
故里飘歌
故里飘歌 2020-11-22 10:28

Using PHP5 (cgi) to output template files from the filesystem and having issues spitting out raw HTML.

private function fetch($name) {
    $path = $this->         


        
11条回答
  •  遥遥无期
    2020-11-22 11:22

    you would use the following code to remove utf8 bom

    //Remove UTF8 Bom
    
    function remove_utf8_bom($text)
    {
        $bom = pack('H*','EFBBBF');
        $text = preg_replace("/^$bom/", '', $text);
        return $text;
    }
    

提交回复
热议问题