How to remove multiple UTF-8 BOM sequences

后端 未结 11 1959
故里飘歌
故里飘歌 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条回答
  •  萌比男神i
    2020-11-22 11:22

    An extra method to do the same job:

    function remove_utf8_bom_head($text) {
        if(substr(bin2hex($text), 0, 6) === 'efbbbf') {
            $text = substr($text, 3);
        }
        return $text;
    }
    

    The other methods I found cannot work in my case.

    Hope it helps in some special case.

提交回复
热议问题