摘要:
使用ThinkPHP框架时,在公共模块Common的Controller 建立AuthController类。之后无论是在前台模块或者后台模块中,在编写接口时,首先实例化AuthController,如果没有访问权限,会自动判断。当然前提是数据库中已建立Think/Auth中指定的表。 阅读全文
摘要:
1 header('content-type:text/html;charset=utf-8'); 2 $file = 'phonenumber.txt'; /*假设文件名为phonenumber.txt,内容为 123-456-7890 135 455 5615 (461) 465-6552 */ 3 $res = getRightNum($file); 4 print_r... 阅读全文
摘要:
$todayStart= date('Y-m-d 00:00:00', time()); //2016-11-01 00:00:00 $todayEnd= date('Y-m-d 23:59:59', time()); //2016-11-01 23:59:59 阅读全文
摘要:
function getNowTime() { var date = new Date(); var seperator1 = "-";//年月日分隔符 var seperator2 = ":";//时分秒分隔符 var month = date.getMonth() + 1; //月份是0~11, 阅读全文
摘要:
注:date_diff是用来计算两个日期之间的差值: <?php ?> //date_diff(datetime1,datetime2,absolute); absolute为false/ture,默认是false,true代表差值必须是正值。 //date_create指的是返回一个新的DateT 阅读全文
摘要:
弱类型语言,php,javascript,将字符串转为浮点型都可以这样做: $str = "45.3"; $str = float($str); 也可以直接在加上0, $str = $str + 0; 此时$str已经是一个浮点型了,当然结果可能小数位数很多,可以 $str = round($str 阅读全文