开发者

php4 decode string to display as html

开发者 https://www.devze.com 2022-12-10 12:42 出处:网络
I\'m very new to PHP and I have a small task of displaying a class list from an XML file.I have managed to figure that part out that took longer than expected.I\'m running into some descriptions that

I'm very new to PHP and I have a small task of displaying a class list from an XML file. I have managed to figure that part out that took longer than expected. I'm running into some descriptions that have html characters that are not displaying on my page. I have tried numerous ways and nothing seems to work for me. Please take a look and let me know what I'm doing wrong.

    $bb = "<P>Do开发者_StackOverflow中文版nt spend another day <B>manually</B> filtering information from your spreadsheets.</P>";        
    $a = htmlentities($bb);
    $b = html_entity_decode($a);


    echo $book['PRODUCTID']." - ".$book['PRODUCTNAME']." - ".$b."<BR/><BR/>";

Thanks


get rid of

    $a = htmlentities($bb);

just use

    $b = html_entity_decode($bb);


something like this will help:

str_replace(array("&lt;", "&gt;"), array("<", ">"), $bb);

that should solve the problem

0

精彩评论

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