从记录中插入html

时间:2012-10-03 13:13:28

标签: php sql recordset

好的,原谅我是愚蠢的,但我是新手。我有一个包含html标签和格式的记录集,例如:

<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-add-space: auto; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst>
<SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·
<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN> <FONT face=Calibri>
Bundle Includes
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <o:p></o:p></FONT></P> 
 <P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto; mso-list: l0 level2 lfo1" class=MsoListParagraphCxSpMiddle>
 <SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'">
 <SPAN style="mso-list: Ignore">o
 <SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN>
<FONT face=Calibri>2 Year Extended Warranty For Toshiba 1 Year Notebook (Inc. Courier Pickup / Return Service) , Suitable for Satellite Pro C665, L730, L750, L770, P770, S750<o:p></o:p></FONT></P>
   <P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto; mso-list: l0 level2 lfo1" class=MsoListParagraphCxSpMiddle>
  <SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'">
  <SPAN style="mso-list: Ignore">o
  <SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN>
   <FONT face=Calibri>Toshiba 75W ACAdaptor 3pin19V<o:p></o:p></FONT></P> 
   <P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto; mso-list: l0 level2 lfo1" class=MsoListParagraphCxSpMiddle>
   <SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'">
    <SPAN style="mso-list: Ignore">o
   <SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN>
   <FONT face=Calibri>BitDefender Internet Security 2012 OEM<o:p></o:p></FONT></P>  <P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 72pt; mso-add-space: auto; mso-list: l0 level2 lfo1" class=MsoListParagraphCxSpLast> <SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"><SPAN style="mso-list: Ignore">o<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri>Everki 16" Advance Compact Bag<o:p></o:p></FONT></P>

现在我需要将它插入到.php页面中,用fommatting编写描述。 当我插入它时,它只是作为原始html出现。

再一次,对某人来说这很简单,所以你的帮助会得到满足

由于

2 个答案:

答案 0 :(得分:0)

Serialize格式保存HTML数据,同时使用它来显示Unserialize

价: - http://php.net/manual/en/function.serialize.php

http://php.net/manual/en/function.unserialize.php

答案 1 :(得分:0)

您的数据库中保存的HTML代码最有可能是HTML编码的实体。尝试在您的数据上调用$myHTML = html_entity_decode($myHTMLFromDatabase)。使用urldecode()stripslashes()确保无法转义任何内容。