易截截图软件、单文件、免安装、纯绿色、仅160KB

php 替换非法字符 保存到数据库


function _processBeforeDb($str)
{
$str = str_replace ( array ('<', '>' ), array ('&lt;' , '&gt;' ), $str );
if (!get_magic_quotes_runtime()){
return addslashes($str);
}
else
{
return $str;
}
}


相关文档:

PHP配置SQL Server 2008

1、到微软官方去下载新的驱动,下载地址如下:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9
 
  官方文档有描述:
  Refer to the documentation that is installed with the driver for a description of the new features in this ......

windows安装apache+php+mysql的一些记录

apache安装,mysql安装,php5直接解压,均放在D:\www下。
目录结构为:
D:\www\apache2
D:\www\mysql
D:\www\php5
将php5\php.ini-dist复制为php.ini,把需要用到的组件将前面的;去掉。

extension=php_mysql.dll
extension=php_gd2.dll
在apache2的conf/httpd.conf文件中加
LoadFile D:/www/php5/php5ts.dll
......

php 正则表达式总结

例:
要求匹配标题
 <div class="detail-hd">
 <h3>
     五皇冠 2010春装新品时尚T恤 长袖 女装长款T恤 热卖韩版长T 特价
   </h3>
$reg="|<div class=\"detail-hd\">[\n\r\t]*<h3>[\n\r\t]*(.*)[\n\r\t]*</h3>|";
pre ......

php中的addslashes函数

昨天在看我的google快讯时看到了php中的这个函数,发现我好像对这个函数不是特别的了解吗
查看了手册,发现了这个函数主要是转义了数据库中的特殊字符,比如 ' 单引号 " 双引号等在数据库中的特殊的字符
当然了这个addslashes使用是要先检查magic_quotes_gpc这个的系统配置了,如果配置了就必须不能在使用了,如果两 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号