Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php xml文件开头的字符 '╗┐_Php_Xml_Encoding_Laravel 5 - Fatal编程技术网

Php xml文件开头的字符 '╗┐

Php xml文件开头的字符 '╗┐,php,xml,encoding,laravel-5,Php,Xml,Encoding,Laravel 5,我怎样才能脱掉'呢╗┐' 从上面的php字符串?当我使用file\u get\u content($file)或laravel的file::get($file)打开文件时,会在各种文本编辑器中显示所有特殊字符。你可以使用preg\u match这样做 ´╗┐<?xml version="1.0" encoding="UTF-8"?> $XML=''╗┐'; preg_match(“/Usesubstr($data,strpos($data)”,您需要删除所有特殊字符或此字符。您可以

我怎样才能脱掉'呢╗┐' 从上面的php字符串?当我使用file\u get\u content($file)或laravel的file::get($file)打开文件时,会在各种文本编辑器中显示所有特殊字符。你可以使用
preg\u match
这样做

´╗┐<?xml version="1.0" encoding="UTF-8"?>
$XML=''╗┐';

preg_match(“/Use
substr($data,strpos($data)”,您需要删除所有特殊字符或此字符。您可以尝试使用此字符。感谢@Ali解决了我的问题。添加作为答案,我将其标记为accepted@AddWebSolution Pvt Ltd str_replace无法工作无法匹配BOM(字节顺序标记)等字符。
$XML = '´╗┐<?xml version="1.0" encoding="UTF-8"?>';

preg_match("/<\?xml.*/", $XML, $matchs);
$newXML = $matchs[0];