Home > Backend Development > PHP Tutorial > 求助:如何在页面显示数据库中的script代码但是却不让它执行

求助:如何在页面显示数据库中的script代码但是却不让它执行

WBOY
Release: 2016-06-23 14:16:33
Original
1336 people have browsed it

如题

例如:  这是一个简介 <script>alert('hah')</script>

用户使用textarea来输入内容并提交,存进数据库

然后读出来显示在前台 就alert了hah 想让它显示也是跟输入的一样却不执行

求教


回复讨论(解决方案)

htmlentities

htmlentities

解决了... 突然脑筋不清楚了 在存入数据库之前用了这个 没起效    刚才看了版大的回复才想起来在输出时用这个   已经不alert了

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template