/** * 清空整个目录 * @param 目录 $path */function clear_dir($path) { ???$op = dir($path); ???while(false != ($item = $op->read())) { ???????if($item == ‘.‘ || $item == ‘..‘) continue; ???????????????if(is_dir($op->path.‘/‘.$item)) { ???????????clear_dir($op->path.‘/‘.$item); ???????????rmdir($op->path.‘/‘.$item); ???????} else { ???????????unlink($op->path.‘/‘.$item); ???????} ???}}
/** * 取消网页缓存 */function header_nocache() { ???header("Cache-Control: no-cache"); ???header("Pragma: no-cache"); ???header("Expires: 0");}
/** * 是否已GET方式访问 * @return boolean */function is_get() { ???return $_SERVER[‘REQUEST_METHOD‘] == "GET";}/** * 是否已POST形式访问 * @return boolean */function is_post() { ???return $_SERVER[‘REQUEST_METHOD‘] == "GET";}
PHP实用函数整理(1)
原文地址:http://www.cnblogs.com/hatsusakana/p/7987266.html