开发者

Displaying feed with the correct html character entities

开发者 https://www.devze.com 2023-01-11 07:25 出处:网络
I have feed that\'s already broken down into the content I need.Part of that content contains things such as &\\; and \"\\;.

I have feed that's already broken down into the content I need. Part of that content contains things such as &\; and "\;.

I'm using PHP's str_replace() to find and replace them to be their correct html character entities (ex. &). However, it won't find this:

 $find = array('&\;', '"\;', '\;');

And I would replace them like this:

 $replace = array('&'开发者_开发问答, '"', '&#59;');

What am I missing in order for the function to find them?


<ul>
    <li>Story Time with Captain Fishbones</li>
    <li>Flashback</li>
    <li>The Office</li>
    <li>The Life &amp\; Music of Ella Fitzgerald</li>
    <li>Circus in the Park</li>
    <li>Symphonicity</li>
    <li>Wreck of the Dictator</li>
    <li>Fireworks</li>  
</ul>
<h3>Thursday, Aug 12</h3>
<ul>
    <li>Historic Villages Tour</li>
    <li>The Janitors</li>
    <li>Mitchell&#039\;s Mayhem</li>
    <li>&quot\;1607 First Landing&quot\; by Chip Fortier</li>
    <li>Adam Queen followed by Randy Hermoso</li>

    <li>The Life &amp\; Music of Ella Fitzgerald</li>
    <li>Shipwrecks and Ghost Lore</li>
    <li>Black White Blues</li>
    <li>Wreck of the Dictator</li>
</ul>


Use html_special_chars() to print the content. Also I think that your $find variable has wrong escape sequences.

0

精彩评论

暂无评论...
验证码 换一张
取 消