摘要: preg_match("/^[\x{4e00}-\x{9fa5}]+$/u",$str) 阅读全文
posted @ 2015-01-20 18:20 Craze_lee 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 3 /* 设定环境 */ 4 define('ENVIRONMENT', 'development'); 5 6 if (defined('ENVIRONMENT')) 7 { 8 switch (ENVIRONMENT) 9 {10 cas... 阅读全文
posted @ 2014-12-16 18:15 Craze_lee 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 基本结构:index.php,system文件夹和application文件夹。index.php是CI的入口文件。system文件夹,是CI的框架核心部分,开发的时候基本是不用去改动的。里面有:|--core 核心部分,包括CI的核心类,CI没运行一次,里面的文件基本都要运行一次。|--datab... 阅读全文
posted @ 2014-12-15 15:30 Craze_lee 阅读(284) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2014-11-21 15:16 Craze_lee 阅读(213) 评论(0) 推荐(0) 编辑
摘要: (DELETE)删除表数据之后,auto_increment不会变成初始值,要重置的方式有两种:1、truncate tbname ;直接清空所有数据,并将auto_increment重置为0。2、alter table tbname auto_increment = x ;设置表tbname的唯一... 阅读全文
posted @ 2014-11-05 15:29 Craze_lee 阅读(818) 评论(0) 推荐(0) 编辑
摘要: 远程链接MySQL,出现上面的错误,说明没有设置可远程链接,可按以下方式解决。1、更改数据库mysql中的user表中的host字段,有localhost改为‘%’ use mysql;update user host='%' where host='localhost'flush privileg... 阅读全文
posted @ 2014-10-31 16:55 Craze_lee 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 今天出现的问题:Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of in_array_two_di... 阅读全文
posted @ 2014-10-30 19:03 Craze_lee 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 最近老大说要实现负载均衡,今天试着玩了下。在nginx.conf配置ip_hash;可以让同一IP的请求落到固定的一台服务器,也就可以用session机制了。这里设置前两个是同一个服务器两个端口, weight设置权重,映射的权重。第三个server是第二个服务器的。80端口是用来监听,443、80... 阅读全文
posted @ 2014-10-30 18:05 Craze_lee 阅读(131) 评论(0) 推荐(0) 编辑
摘要: PHP中的内置函数采用的算法是快排。下面是PHP实现的快排 1 function quick_sort($array) { 2 if (count($array) <= 1) return $array; 3 4 $key = $array[0]; 5 ... 阅读全文
posted @ 2014-10-27 18:08 Craze_lee 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Given this linked list:1->2->3->4->5Fork= 2, you should return:2->1->4->3->5Fork= 3, you should return:3->2->1->4->5思路:一开始是想要动态规划的方式,即写一个反转函数,每K个字符调用一... 阅读全文
posted @ 2014-10-27 10:25 Craze_lee 阅读(161) 评论(0) 推荐(0) 编辑