最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php常用函数
时间:2008-08-25 编辑:简简单单 来源:一聚教程网
function stripslashes_content(&$content) {
if(get_magic_quotes_gpc() == 0) {
$content = str_replace("'","'",$content);
$content = str_replace('-',"-",$content);
$content = str_replace('`',"`",$content);
$content = str_replace('"',""",$content);
$content = str_replace("\","\\",$content);
}
return $content;
}
function checkNumber($num) {
return ((string)(int)$num === (string)$num ? true : false);
}
function isemail($email) {
return strlen($email) > 6 &&
preg_match("/^[w-.]+@[w-.]+(.w+)+$/", $email);
}
function dhtmlspecialchars($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = dhtmlspecialchars($val);
}
} else {
$string =
preg_replace('/&((#(d{3,5}|x[a-fA-F0-9]{4})|[a-zA-Z][a-z0-9]{2,5});)
/', '&\1',
str_replace(array('&', '"', '<', '>'), array('&', '"', '<',
'>'), $string));
}
return $string;
}
function getReply($id) {
global $db,$db_tables;
$db->query("SELECT * FROM {$db_tables['repeat']} WHERE id='{$id}'");
$reply = $db->fetch();
if(is_array($reply))
return $reply;
else
return false;
}
-
上一个: php 数据查询与连接类
-
下一个: php实现数据缓存程序
相关文章
- php中bind_param()函数用法分析 08-03
- PHP函数rtrim()使用中的怪异现象分析 05-01
- php 基础函数 03-27
- php 常用的系统函数 03-17
- 给大家分享几个常用的PHP函数 01-19
- PHP162个常用函数总结 12-28