更新时间:2023-12-04 13:40:04
如果要查找的是清理损坏的XML文件的方法,则只需添加运行爆炸时丢失的字符串即可.都有点黑,但是行得通.
If what you are looking for is a way to cleanup the corrupt XML file, you can just add the string that gets missing when the explode is run. It is all a bit hackish, but it works.
$file = '/Users/jasenburkett/Sites/jobsark/feed.xml';
$data = file_get_contents($file);
$split = "</JobSearchResults>"; // Split on this
$parts = explode($split, $data); // Make the split
$cleanedXml = $parts[0]; // Use first part
$cleanedXml .= $split; // Put back last ending tag
file_put_contents($file, $cleanedXml);