<?php function request_post($url = '', $post_data = array()) { if (empty($url) || empty($post_data)) { return false; } $o = ""; foreach ( $post_data as $k =>...
/**获取文件扩展名@param 网页URL $url@return string@author zero<512888425@qq>*/function getUrlFileExt($url){$ary = parse_url($url); $file = basename($ary['path']); $ext = explode('.',$file); return iss...
/** * 不重复的随机数 * 用作采集时的文件,批量下载进防止文件重复 */ function random_id() { $chars = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $chars_cnt = strlen($chars)-1; $id = '';...
/*** 处理禁用HTML但允许换行的内容 * * @access public * @param string $msg 需要过滤的内容 * @return string */ function TrimMsg($msg) { $msg = trim(stripslashes($msg)); $msg = nl2br(htmlspecialchar...
//获得某天前的时间戳 function getxtime($day) { $day = intval($day); return mktime(23,59,59,date("m"),date("d")-$day,date("y")); }
//生成字母前缀 function letter_first($s0) { $firstchar_ord=ord(strtoupper($s0{0})); if (($firstchar_ord>=65 and $firstchar_ord<=91)or($firstchar_ord>=48 and $firstchar_...
/ PHP escape /public static function escape($str) {preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(ord($v[0]) < 128) { $a...
//循环显示文件,返回array public static function dirAllFile($dirName) { // global $array; $array = array(); // util::pre_print_r($array); if ($handle = opendir("$...
//循环删除目录和文件函数 public static function delDirAndFile($dirName, $delDir = 0) { if ($handle = opendir("$dirName")) { while (false !== ( $item = readdir($h...
/**$sourcestr 是要处理的字符串$cutlength 为截取的长度(即字数) */static function cut_str($sourcestr, $cutlength, $type = true){$returnstr = ''; $i = 0; $n = 0; $str_length = strlen(trim($sourcestr)); //字符串的字节数 wh...