Currently I have an XML file
<?xml version="1.0" encoding="UTF-8"?>
<Workflow xmlns="http://ns.adobe.com/acrobat/workflow/2012" title="HongKong2_Convert_img" description="" majorVersion="1" minorVersion="0">
<Sources><Folder path="/C/Source/HongKong2/temp"/></Sources>
</Workflow>
What I would like to do is to replace <
with < and >
with > .
$handle = fopen('a.xml', "r+") or die();
while(!feof($handle)) {
if (strstr(fgets($handle),"<") || strstr(fgets($handle),">")) {
echo 'tttt';
fwrite($handle, str_replace("<", "<", fgets($handle)));
fwrite($handle, str_replace(">", ">", fgets($handle)));
}
}
fclose($handle);
I can trigger the if condition and it should be correct. The only problem is it can not replace that line (some problem with fwrite..) . How to fix that? thanks