php 字符串加转义

php 字符串加转义

// 字符串加转义 function add_slashes($string){ if (!$GLOBALS['magic_quotes_gpc']) { if (is_array($string)) { foreach($string as $key => $val) { $string[$key] = add_slashes($val); } } else { $string = addslashes($string); ...

PHP 2021-11-05 PM 1958℃ 0条
php 过滤js、css等

php 过滤js、css等

/** * 过滤js、css等 */ function filter_html($html){ $find = array( "/<(\/?)(script|i?frame|style|html|body|title|link|meta|\?|\%)([^>]*?)>/isU", "/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU", "/javascript\s*:/isU", ); ...

PHP 2021-11-05 PM 2354℃ 0条
php 生成guid

php 生成guid

function guid(){ return md5(microtime(true).rand_string(20)); }

PHP 2021-11-05 PM 2610℃ 0条
php 获取精确时间

php 获取精确时间

/** * 获取精确时间 */ function mtime(){ $t= explode(' ',microtime()); $time = $t[0]+$t[1]; return $time; }

PHP 2021-11-05 PM 2182℃ 0条
php 根据id获取短标识

php 根据id获取短标识

/** * 根据id获取短标识; * 加入时间戳避免猜测;id不可逆 * * eg: 234==>4JdQ9Lgw; 100000000=>4LyUC2xQ */ function short_id($id){ $id = intval($id) + microtime(true)*10000; $id = pack('H*',base_convert($id,10,16)); $base64 = base64_encode($id); $replace = array('/'=>'_','+'=>'-','='=...

PHP 2021-11-05 PM 1968℃ 0条
php 删除字符串两端的字符串

php 删除字符串两端的字符串

// 删除字符串两端的字符串 function str_trim($str,$remove){ return str_rtrim(str_ltrim($str,$remove),$remove); } function str_ltrim($str,$remove){ if(!$str || !$remove) return $str; while(substr($str,0,strlen($remove)) == $remove){ $str = substr($str,strlen($remove)); } return $st...

PHP 2021-11-05 PM 2145℃ 0条
php清除多余空格和回车字符

php清除多余空格和回车字符

// 清除多余空格和回车字符 function strip($str){ return preg_replace('!\s+!', '', $str); }

PHP 2021-11-05 PM 2426℃ 0条
PHP 文本字符串替换转换函数

PHP 文本字符串替换转换函数

/** * 文本字符串转换 */ function mystr($str){ $from = array("\r\n", " "); $to = array("<br/>", "&nbsp"); return str_replace($from, $to, $str); }

PHP 2021-11-05 PM 2166℃ 0条
Navicat将MySQL8.0导入到MySQL5.7

Navicat将MySQL8.0导入到MySQL5.7

打开.sql文件utf8mb4替换为utf8utf8mb4_0900_ai_ci替换为utf8_general_ciutf8_croatian_ci替换为utf8_general_ciutf8mb4_general_ci替换为utf8_general_ci

数据库 2021-11-04 PM 2315℃ 0条
Linux 查看CPU信息,机器型号,内存等信息

Linux 查看CPU信息,机器型号,内存等信息

系统uname -a # 查看内核/操作系统/CPU信息head -n 1 /etc/issue # 查看操作系统版本cat /proc/cpuinfo # 查看CPU信息hostname # 查看计算机名lspci -tv # 列出所有PCI设备lsusb -tv # 列出所有USB设备lsmod # 列出加载的内核模块env # 查看环境变量资源free -m #...

linux 2021-11-01 AM 2396℃ 0条
Linux命令判断CC攻击的方法(查看连接数)

Linux命令判断CC攻击的方法(查看连接数)

查看所有80端口的连接数netstat -nat|grep -i "80"|wc -l对连接的IP按连接数量进行排序netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n查看TCP连接状态netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rnnetstat -n |grep TIME_WAIT| awk '{print $5}' | sort | uniq -c | sort -rnnetstat -n | awk '/^tcp/ {++S[$NF]...

linux 2021-11-01 AM 2215℃ 0条