php使用htmlentities函数转换html实体 $str="<script>alert('www.qipa250.com')</script>"; echo htmlentities($str, ENT_QUOTES);