技术库 技术手册 字体库 知识点 词汇表 联系我们
内容搜索   
本站最新推出网站制作字体库。
当前位置:WEB技术知识资源库(www.cn-web.com) .: PHP技术 .: PHP问题集锦 .: php读取数据库中数据常用的过滤/转换函数

php读取数据库中数据常用的过滤/转换函数


入库时

  $str=addslashes($str);

  $sql="insert into `tab` (`content`) values('$str')";

  出库时

  $str=stripslashes($str);

  在页面中显示时

  $str=htmlspecialchars(nl2br($str)) ;
  <?php

  //$content来自数据库

  $content=nl2br(htmlspecialchars($content));

  $content=str_replace(" ","&nbsp;",$content);

  $content=str_replace("n","<br>n",$content);

  ?>


对此文章打分评级

用户评论

增加评论
此文章还没有任何评论!
网站地图 - 知识词汇 - 全文检索 - 广告服务 - 帮助中心 - 联系我们
.:www.cn-web.com
网站技术开发联盟之WEB开发技术知识库
联系人:老韩(QQ:5679551)
晋ICP备07003487号