摘要: 方法一: 1 function King($arr, $count){ 2 $i = 1; 3 while(count($arr) > 1){ 4 if($i%$count == 0){ 5 unset($arr[$i-1]); 6 }else{ 7 array_push($arr, $arr[$i 阅读全文
posted @ 2016-02-24 12:09 hell0x 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 function tree($arr, $pid=0, $level=0){ 3 static $list = array(); 4 foreach($arr as $v){ 5 if($v['parent_id'] == $pid){ 6 $v['level'] = $leve 阅读全文
posted @ 2016-02-19 14:55 hell0x 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 function my_scandir($dir){ 3 $files = array(); 4 if(is_dir($dir)){ 5 if($handle = opendir($dir)){ 6 while(($file = readdir($handle)) !== fal 阅读全文
posted @ 2016-02-19 14:40 hell0x 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 $conn = mysql_connect("localhost", "root", "") or die("连接错误"); 3 mysql_select_db("test"); 4 mysql_query("set names utf8"); 5 6 //获取总数量 7 $sq 阅读全文
posted @ 2016-02-15 15:55 hell0x 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 7-1update()方法,不过key相同的话,会用后面的value覆盖前面的7-2字典,列表不行,元组可以因为字典和列表是可变的,元组是不可变的,不可变的对象能作为字典的键7-37-47-5略7-6略7-77-8 1 def dit(): 2 dict1 = {} 3 while ... 阅读全文
posted @ 2016-01-25 16:11 hell0x 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 function my_scandir($dir){ 3 $files = array(); 4 if(is_dir($dir)){ 5 if($handle=opendir($dir)){ 6 while(($file=readdir($handle))!==false){ 7 阅读全文
posted @ 2016-01-20 11:25 hell0x 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 6-1成员操作符in可以判断一个字符串是否是另一个字符串的一部分。返回true或false。6-2 1 import string 2 import keyword 3 4 myInput = raw_input("Please input the string: ") 5 6 if len(m... 阅读全文
posted @ 2016-01-18 15:47 hell0x 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 1.file_get_contents得到文件的内容 1 <?php 2 header("content-type:text/html;charset=utf-8"); 3 4 $file_path = 'lock.txt'; 5 6 $conn = file_get_contents($file_ 阅读全文
posted @ 2016-01-16 11:55 hell0x 阅读(898) 评论(0) 推荐(0) 编辑
摘要: 我想成为一个更优秀的人,对父母,对梦想,对生活,对自己。 大四,也算是正式进入了实习和工作阶段,开学后,找了份工作,挺轻松,每天完成自己的任务后可以有很多时间学习自学一些新东西,这对于现阶段的我来说还是挺不错的。作息规律也比在学校规律了很多,果然我还是适合一个人生活和规划,这样生活或许更有效率。这份 阅读全文
posted @ 2016-01-15 15:28 hell0x 阅读(170) 评论(0) 推荐(0) 编辑
摘要: PHP上传文件改进版: 阅读全文
posted @ 2016-01-13 14:29 hell0x 阅读(144) 评论(0) 推荐(0) 编辑