简体   繁体   English

字符串中的Html标记在浏览器中不起作用

[英]Html tag in the string not working in browser

I am trying to display some information coming from the database. 我试图显示来自数据库的一些信息。 Database field takes the input from the ck-editor and save the HTML as a string. 数据库字段从ck编辑器获取输入并将HTML保存为字符串。

在此输入图像描述

Now when I am trying to display those data it comes like as the blue section in the above image. 现在,当我尝试显示这些数据时,它就像上图中的蓝色部分一样。 But I want it as the red section. 但我希望它作为红色部分。

 echo "Product Name : Personal Loan<span><br>Loan Range :<br>Minimum : 50000<br>Maximum : 2000000<br>Loan Repayment Tenure :<br>Minimum 1 Year<br>Maximum 5 Years</span><br>";

When I use this code the red block section of the above image is showing 当我使用此代码时,将显示上图中的红色块部分

but when I use 但是当我用的时候

echo $infos['Loan']['addtional_features'];

the blue section is showing. 蓝色部分正在显示。 that is, the all string with the tag is displaying. 也就是说,显示带有标记的所有字符串。

What could be the reason? 可能是什么原因?

It seems like the string stored is HTML-encoded twice (eg &lt;br&gt; , instead of <br> ). 看起来存储的字符串是HTML编码的两次(例如&lt;br&gt;而不是<br> )。 Try to html_entity_decode() your string, before to write it in the output. 尝试html_entity_decode()你的字符串,然后在输出中写入它。

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

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