<?php /** *to do 用于检查BOM头 *@param string $url *@return boolean */ //检查BOM头 public function checkBom($contents) { $charset[1] = substr($contents,0,1); $charset[2] = substr($contents,1,1); $charset[3] = substr($contents,2,1); if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) { return substr($contents,3); } return $contents; }