简体   繁体   English

从记录中插入html

[英]inserting html from a record

OK forgive me for being dumb but im new to this. 好的,请原谅我愚蠢,但我对此并不陌生。 I have a record set which contains html tags and formatting with descriptions in eg: 我有一个记录集,其中包含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>

Now I need to insert this into a .php page to write the description with the fommatting. 现在,我需要将其插入.php页面以编写带有fommatting的描述。 When I insert it, it just comes up as the raw html. 当我插入它时,它只是作为原始html出现。

Again its prob simple to someone so your help would be appriciated 再次对某人来说这很简单,因此您的帮助会得到帮助

Thanks 谢谢

Save HTML data in Serialize format, while using it to display Unserialize it. Serialize格式保存HTML数据,同时使用它显示Unserialize Serialize

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

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

It's most likely that your HTML code saved in your database has it's HTML entities encoded. 保存在数据库中的HTML代码很可能已经对HTML实体进行了编码。 Try calling $myHTML = html_entity_decode($myHTMLFromDatabase) on your data. 尝试在数据上调用$myHTML = html_entity_decode($myHTMLFromDatabase) Make sure nothing is escaped either by using urldecode() and stripslashes() . 使用urldecode()stripslashes()确保没有任何逸出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM