摘要: //避免频繁请求 (ThinkPHP) $sessID = 'register' . $data['mobile_code_id'] . $data['mobile'] . $data['password']; if(!(new \think\session\driver\Redis())->lock($sessID,3)){ throw new \Exception('频繁请求'); } //自 阅读全文
posted @ 2019-08-15 18:16 炜华 阅读(1044) 评论(1) 推荐(0) 编辑
摘要: /*1.Connection*/$redis = new Redis();$redis->connect('127.0.0.1',6379,1);//短链接,本地host,端口为6379,超过1秒放弃链接$redis->open('127.0.0.1',6379,1);//短链接(同上)$redis 阅读全文
posted @ 2019-08-15 17:31 炜华 阅读(7385) 评论(0) 推荐(1) 编辑
摘要: 3.命令参数: -u user:用来设定某个用户的crontab服务,例如,“-u ixdba”表示设定ixdba用户的crontab服务,此参数一般有root用户来运行。 file:file是命令文件的名字,表示将file做为crontab的任务列表文件并载入crontab。如果在命令行中没有指定 阅读全文
posted @ 2019-08-15 17:28 炜华 阅读(214) 评论(0) 推荐(0) 编辑
摘要: //注释:键名数组和键值数组的元素个数必须相同! $users = array( array( 'id' => 1, 'name' => 'tom', 'age' => 20 ), array( 'id' => 5, 'name' => 'anny', 'age' => 18 ), array( 'id' => 3, 'name' => 'jack', 'age&# 阅读全文
posted @ 2019-08-15 17:27 炜华 阅读(972) 评论(0) 推荐(0) 编辑
摘要: <?phpusers = array( array( 'name' => 'tom', 'age' => 20 ), array( 'name' => 'anny', 'age' => 18 ), array( 'name' => 'jack', 'age' => 22 ) ); array_multisort($users, SORT_ASC, array_column($users, 'age 阅读全文
posted @ 2019-08-15 17:17 炜华 阅读(113) 评论(0) 推荐(0) 编辑
摘要: <?php $start_time = microtime(true); for ($i=0;$i<100000000;$i++){}; $end_time = microtime(true); echo '循环执行时间为:'.($end_time-$start_time).' s'; 阅读全文
posted @ 2019-08-15 17:10 炜华 阅读(758) 评论(0) 推荐(0) 编辑
摘要: $str = 'a b c d e '; $str = preg_replace('# #','',$str); var_dump($str);//输出 "abcde" 阅读全文
posted @ 2019-08-15 16:54 炜华 阅读(1081) 评论(0) 推荐(0) 编辑