0

好的,请原谅我的愚蠢,但我对此很陌生。我有一个记录集,其中包含 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 页面中以使用格式编写描述。当我插入它时,它只是作为原始 html 出现。

这对某人来说很简单,所以你的帮助会很重要

谢谢

4

2 回答 2

0

您保存在数据库中的 HTML 代码很可能已对其 HTML 实体进行了编码。尝试调用$myHTML = html_entity_decode($myHTMLFromDatabase)您的数据。urldecode()使用and确保没有任何内容被转义stripslashes()

于 2012-10-03T13:28:32.993 回答
0

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

参考:- http://php.net/manual/en/function.serialize.php

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

于 2012-10-03T13:21:28.103 回答