js 获取父页面完整URL

js 获取父页面完整URL

/** * 获取父页面完整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...

前端 2021-03-18 PM 1792℃ 0条
js 或点击链接给textarea 赋值

js 或点击链接给textarea 赋值

[官方下载] document.getElementById("note21").value='checkedItem.note';

前端 2021-03-08 PM 1701℃ 0条
php 获取文件扩展名

php 获取文件扩展名

/**获取文件扩展名@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] : '';}

PHP 2021-02-28 PM 1980℃ 0条
php 不重复的随机数

php 不重复的随机数

/** * 不重复的随机数 * 用作采集时的文件,批量下载进防止文件重复 */ function random_id() { $chars = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $chars_cnt = strlen($chars)-1; $id = ''; for ($i = 0; $i < 5; ++$i) { $id .= $chars[rand(0, $chars_cnt)]; } ...

PHP 2021-02-28 PM 1730℃ 0条
php 处理禁用HTML但允许换行的内容

php 处理禁用HTML但允许换行的内容

/*** 处理禁用HTML但允许换行的内容 * * @access public * @param string $msg 需要过滤的内容 * @return string */ function TrimMsg($msg) { $msg = trim(stripslashes($msg)); $msg = nl2br(htmlspecialchars($msg)); $msg = str_replace(" ","&nbsp;&nbsp;",$msg); return a...

PHP 2021-02-28 PM 1648℃ 0条
php 获得某天前的时间戳

php 获得某天前的时间戳

//获得某天前的时间戳 function getxtime($day) { $day = intval($day); return mktime(23,59,59,date("m"),date("d")-$day,date("y")); }

PHP 2021-02-28 PM 2086℃ 0条
php 生成字母前缀

php 生成字母前缀

//生成字母前缀 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 2021-02-28 PM 1707℃ 0条
PHP escape unescape

PHP escape unescape

/ 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...

PHP 2021-02-28 PM 2177℃ 0条
php循环显示文件,返回array

php循环显示文件,返回array

//循环显示文件,返回array public static function dirAllFile($dirName) { // global $array; $array = array(); // util::pre_print_r($array); if ($handle = opendir("$dirName")) { while (false !== ( $item = readdir($handle) )) { ...

PHP 2021-02-28 PM 1851℃ 0条
php循环删除目录和文件函数

php循环删除目录和文件函数

//循环删除目录和文件函数 public static function delDirAndFile($dirName, $delDir = 0) { if ($handle = opendir("$dirName")) { while (false !== ( $item = readdir($handle) )) { if ($item != "." && $item != ".."...

PHP 2021-02-28 PM 1838℃ 0条
php 截取字符串

php 截取字符串

/**$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); ...

PHP 2021-02-28 PM 1731℃ 0条