/** * 检验手机号码 */ if (!function_exists('check_phone_number')) { function check_phone_number($phone_number) { //中国联通号码:130、131、132、145(无线上网卡)、155、156、185(iPhone5上市后开放)、186、176(4G号段)、175(2015年9月10日正式启用,暂只对北京、上海和广东投放办理),166,146 //中国移动号码:134、135、136、137、138、139、147(无线上网卡)、148、150、151、152、157、158、159、178、182、183、184、187、188、198 //中国电信号码:133、153、180、181、189、177、173、149、199 $g = "/^1[34578]\d{9}$/"; $g2 = "/^19[89]\d{8}$/"; $g3
/** * 几秒几天前,时间转换 * @return string */ if (!function_exists('format_time_ago')) { function format_time_ago($date) { if(is_numeric($date)){ $timer = $date; }else{ $timer = strtotime($date); } $diff = $_SERVER['REQUEST_TIME'] - $timer; $day = floor($diff / 86400); $free = $diff % 86400; if ($day > 0) { return $day . "天前"; } else { if ($free > 0) {
定义前: http://doamin/index.index/index http://doamin/admin.index/index Route::rule(':version/:controller/:action',':version.:controller/:action'); 定义后: http://doamin/index/index/index http://doamin/admin/index/index
# 指定允许跨域的方法,*代表所有 add_header Access-Control-Allow-Methods *; # 预检命令的缓存,如果不缓存每次会发送两次请求 add_header Access-Control-Max-Age 3600; # 不带cookie请求,并设置为false add_header Access-Control-Allow-Credentials false; # 表示允许这个域跨域调用(客户端发送请求的域名和端口) # $http_origin动态获取请求客户端请求的域 不用*的原因是带cookie的请求不支持*号 add_header Access-Control-Allow-Origin $http_origin; # 表示请求头的字段 动态获取 add_header Access-Control-Allow-Headers $http_access_control_request_headers; # O
access-control-allow-origin:* access-control-allow-credentials:true 600