/** * 获取父页面完整URL * @return {[type]} [description] * @author danye.cc 2017-04-22 */ function parentUrl(){ var url = null; var furl = $('#from_url').val(); if(furl) return furl; if (parent !== window) { try { ur...
[官方下载] document.getElementById("note21").value='checkedItem.note';
/**获取文件扩展名@param 网页URL $url@return string@author zero<512888425@qq> */function getUrlFileExt($url){$ary = parse_url($url); $file = basename($ary['path']); $ext = explode('.',$file); return isset($ext[1]) ? $ext[1] : '';}
/** * 不重复的随机数 * 用作采集时的文件,批量下载进防止文件重复 */ function random_id() { $chars = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $chars_cnt = strlen($chars)-1; $id = ''; for ($i = 0; $i < 5; ++$i) { $id .= $chars[rand(0, $chars_cnt)]; } ...
/*** 处理禁用HTML但允许换行的内容 * * @access public * @param string $msg 需要过滤的内容 * @return string */ function TrimMsg($msg) { $msg = trim(stripslashes($msg)); $msg = nl2br(htmlspecialchars($msg)); $msg = str_replace(" "," ",$msg); return a...
//获得某天前的时间戳 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_ord<=57)) return $s0{0}; //$s = iconv("utf-8", "gbk//ignore", $s0); ...
/ 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) { $ar[$k] = rawurlencode($v); } else { $ar[$k] = "%u".bin2hex(iconv(NUll,"UCS...
//循环显示文件,返回array public static function dirAllFile($dirName) { // global $array; $array = array(); // util::pre_print_r($array); if ($handle = opendir("$dirName")) { while (false !== ( $item = readdir($handle) )) { ...
//循环删除目录和文件函数 public static function delDirAndFile($dirName, $delDir = 0) { if ($handle = opendir("$dirName")) { while (false !== ( $item = readdir($handle) )) { if ($item != "." && $item != ".."...
/**$sourcestr 是要处理的字符串$cutlength 为截取的长度(即字数) */static function cut_str($sourcestr, $cutlength, $type = true){$returnstr = ''; $i = 0; $n = 0; $str_length = strlen(trim($sourcestr)); //字符串的字节数 while (($n < $cutlength) and ($i <= $str_length)) { $temp_str = substr($sourcestr, $i, 1); ...