How do I replace ”
into "
in my php code?
Current XML output (Partial)
<content type="html"><![CDATA[<p style="text-align: justify;">Lorem Ipsum is simply dummy text of the printing and typesetting industry.
<p style="text-align: justify;"><br style=”clear:both;”/>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
<p style="text-align: justify;"><br style=”clear:both;”/>Click <a href="http://www.google.com/" target="_blank">here</a> for more information.]]></content>
As you can see there is ”
wrapping clear:both;
style. All I want is replace it to "
.
My PHP Code (not working)
<content type="html"><![CDATA[<?php echo str_replace("\”","",$row["content"]); ?>]]></content>
PS: The ”
already inside database.
Update:
If you test on your server with
<?php
$data = "<a style=”clear:both;”></a>";
echo str_replace('”','"',$data);
?>
Output : "clear:both;"
It will never work.
But if you try with
<?php
$data = "”clear:both;”";
echo str_replace('”','"',$data);
?>
Output : nothing
It's working! But I want it work within tag....
I've just tested, and the following is working fine for me:
<?php echo str_replace ( '”','"', $row["content"] ); ?>
I'm replacing ” with ".
Edit: Replace the quotes in your source or if not possible, before you insert it to your database.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.