PHP自定义函数(16)--- 遍历文件夹下所有文件
function read_all ($dir){ if(!is_dir($dir)) return false; $handle = opendir($dir); if($handle){ while(($fl = readdir($handle)) !== fa
function read_all ($dir){ if(!is_dir($dir)) return false; $handle = opendir($dir); if($handle){ while(($fl = readdir($handle)) !== fa
function download($filename){ if ((isset($filename))&&(file_exists($filename))){ header("Content-length: ".filesize($filename));
function getExtension($filename){ $myext = substr($filename, strrpos($filename, '.')); return str_replace('.','',$myext); }
PHP加密解密 function encryptDecrypt($key, $string, $decrypt){ if($decrypt){ $decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key)
$timestamp = strtotime('October'); //也可以这么写$timestamp = strtotime('2012-02'); $days = date('t',$timestamp); echo $days; //31
// 文件测试 $array = array( '001' => '123', '002' => '321', '003' => '4321', ); $path = './Cache
//sql注入 function inject_check($sql_str) { return eregi('select|insert|and|or|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile',
function CheckUserID($uid, $msgtitle='用户名'){ //系统字符限制 $cfg_mb_notallow = 'www,bbs,ftp,mail,user,users,admin,administrator'; $nas = explode
function format_str1($str){ $str = str_replace("\r\n","",$str); $str = str_replace("\n","",$str); $str = str_replace("\r","",$str); $s
function getIP(){ static $realip; if (isset($_SERVER)){ if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){ $realip = $_SERVER["