菜鸟请教个html、js标签转化为字符串html的问题

jzm3709225 jzm3709225 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
数据代添页码
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="newsAction.php">
<p>
<laber>标题:</laber><input type="text" name="title"/>
</p>
<p>
<laber>内容:</laber><textarea name="content" rows="5" cols="40"></textarea>
</p>
<input type="hidden" name="act" value="add"/>
<input type="submit" value="提交"/>
</form>
</body>
</html>


接收数据代码
<?php
header('content-type:text/html; utf-8');

$act=$_POST['act'];
$title=trim($_POST['title']);
$content=$_POST['content'];
echo $title;

?>


我在标题跟内容那里面输入 <script>alert('hello girl')</script>
提交后就弹出个警告框hello girl,
小生弱弱的问下,遇到这种情况该如何解决,
PHP是否有什么函数可以把这些敏感点的标签转成字符串html.
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
jzm3709225
基础编程 21,889 成员 140,329 内容