<?php // hook model_check_start.php function is_word($s) { // hook model_is_word_start.php $r = preg_match('#^\\w{1,32}$#', $s, $m); // hook model_is_word_end.php return $r; } ...
PHP 修改本地配置文件/** * 修改本地配置文件 * * @param array $name ['配置名'] * @param array $value ['参数'] * @return void */ function setconfig($name, $value) { if (is_array($name) and is_array($value)) {...
//生成随机用户名 function get_username() { $chars1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $chars2 = "abcdefghijklmnopqrstuvwxyz0123456789"; $username = ""; for ( $i ...
PHP判断当前时间是否在指定时间段之内/** * 判断当前时间是否在指定时间段之内 * @param integer $a 起始时间 * @param integer $b 结束时间 * @return boolean */ function check_time($a,$b) { $nowtime = time(); $start = strtotime($a.'...
PHP 常用函数 检查图片是不是bases64编码的function is_mobile($tel){ if(preg_match("/^1[345789]{1}\d{9}$/",$tel)){ return true; }else{ return false; } } /* * 检查图片是不是bases64编码...
基于阿里云(万网)域名检测接口<?php $result = whois('WWW.AEINK.COM'); $xml = simplexml_load_string($result); $code = is_register($xml->original); if ($code == 0) { echo '域名可以注册'; } else if ($code == 1) ...
PHP 判断是否 URL 链接一、正则<?phpfunction is_url($url){$r = "/http[s]?:\/\/[\w.]+[\w\/]*[\w.]*\??[\w=&\+\%]*/is"; if(preg_match($r,$url)){ //return true; echo '正确的 url 地址'; }else{ ...
php计算字符串中字符串的出现次数我的问题如下:是否有返回出现次数的字符串函数,例如substr_count(),但带有限制选项?我想计算字符串中 'a' 的出现次数,但在第一个换行符之前。您可以使用substr()withstrpos()获取换行符之前的所有内容,然后使用substr_count()获取出现次数:$text = substr($string, 0, strpos($stri...
我想将一个大文本分成 10 个部分(不知何故相等)。ii 使用此功能:<?php function chunk($msg) { $msg = preg_replace('/[\r\n]+/', ' ', $msg); //define character length of each text piece $chunks = wordwrap($msg, 10000,...
错误解决:message:cURL error 60: SSL certificate problem: unable to get local issuer certificate证书问题如果您的 PHP 环境证书有问题,可能会遇到报错,类似于cURL error 60: See http://curl.haxx.se/libcurl/c/libcurl-errors.html,请尝试按以...