How to remove multiple UTF-8 BOM sequences

后端 未结 11 1796
故里飘歌
故里飘歌 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:24

    A solution without pack function:

    $a = "1";
    var_dump($a); // string(4) "1"
    
    function deleteBom($text)
    {
        return preg_replace("/^\xEF\xBB\xBF/", '', $text);
    }
    
    var_dump(deleteBom($a)); // string(1) "1"
    

提交回复
热议问题