03 2016 档案

摘要:$array = array(2,3,5,6,9,8,1); //冒泡排序思想,前后元素比较 function sort_bulldle($array){ $num = count($array); for($i=0; $i=0; $j--) { if ($tmp =0;$j--) { if($tmp $array[$i]) {... 阅读全文
posted @ 2016-03-25 17:55 北京流浪儿 阅读(255) 评论(0) 推荐(0) 编辑
摘要:1、首先需要一个可以外网访问的接口url。 我这里是申请的新浪免费云服务器,http://xxxxx.applinzi.com/wx.php,具体自己可以去新浪云中心申请地址为:http://www.sinacloud.com 2、去微信公众账号申请个人的公众账号,地址为:https://mp.we 阅读全文
posted @ 2016-03-16 18:27 北京流浪儿 阅读(590) 评论(0) 推荐(0) 编辑
摘要:  阅读全文
posted @ 2016-03-14 11:58 北京流浪儿 阅读(356) 评论(0) 推荐(0) 编辑
摘要:使用xpath多线程爬取百度贴吧内容 #encoing=utf-8 from lxml import etree from multiprocessing.dummy import Pool as ThreadPool import requests import json import sys r 阅读全文
posted @ 2016-03-06 13:04 北京流浪儿 阅读(481) 评论(0) 推荐(0) 编辑
摘要:xpath的多线程爬虫 #encoding=utf-8 ''' pool = Pool(4) cpu的核数为4核 results = pool.map(爬取函数,网址列表) ''' from multiprocessing.dummy import Pool as ThreadPool import 阅读全文
posted @ 2016-03-06 11:24 北京流浪儿 阅读(278) 评论(0) 推荐(0) 编辑
摘要:爬取网页内容的时候,往往网页标签比较复杂,对于这种情况,需要用xpath的starts-with和string(.)功能属性来处理,具体看事例 #encoding=utf-8 from lxml import etree html1 = ''' <!DOCTYPE html> <html> <hea 阅读全文
posted @ 2016-03-06 10:52 北京流浪儿 阅读(797) 评论(0) 推荐(0) 编辑
摘要:1、如果你没有安装lxml,请运行pip install lxml或者easy_install lxml安装,如果在安装过程中失败的话, 是因为lxml需要依赖某些库文件,具体可以问下度娘,这里不再赘述。 2、安装成功后,请看下面测试代码 //:定位根节点/:往下层寻找/text(): 提取文本内容 阅读全文
posted @ 2016-03-06 10:24 北京流浪儿 阅读(841) 评论(0) 推荐(0) 编辑
摘要:1、使用file 函数直接读取 $starttime = microtime_float(); ini_set('memory_limit','-1'); $file = "testfile.txt"; $data = file($file); $line = count($data);//总行数 阅读全文
posted @ 2016-03-03 17:25 北京流浪儿 阅读(459) 评论(0) 推荐(0) 编辑
摘要:1、工厂模式 <?php namespace Facebab; class Factory { static function createDatabase () { return new Database(); } } $db = Facebab\Factory::createDatabase() 阅读全文
posted @ 2016-03-03 10:50 北京流浪儿 阅读(242) 评论(0) 推荐(0) 编辑
摘要:1、自动装载实例 目录下有3个文件:index.php load.php tests文件夹 tests文件夹里有 test1.php <?php namespace Tests; class Test1{ static function test(){ echo __CLASS__.'<br>'; 阅读全文
posted @ 2016-03-03 10:32 北京流浪儿 阅读(197) 评论(0) 推荐(0) 编辑
摘要:#!/bin/sh #Today=`date +%Y%m%d` YEAR=`echo $1|cut -c 1-4` MONTH=`echo $1|cut -c 5-6` DAY=`echo $1|cut -c 7-8` TIME=$YEAR-$MONTH-$DAY #echo `date -d "$ 阅读全文
posted @ 2016-03-02 21:12 北京流浪儿 阅读(712) 评论(0) 推荐(0) 编辑
摘要:#encoding=utf-8 class Tree(): def __init__(self,leftjd=0,rightjd=0,data=0): self.leftjd = leftjd self.rightjd = rightjd self.data = data class Btree() 阅读全文
posted @ 2016-03-02 15:34 北京流浪儿 阅读(825) 评论(0) 推荐(0) 编辑
摘要:1、缓存配置 只需在http的server模块里配置即可,如: location ~.*\.(jpg|png|gif)$ { expires 30d; } location ~.*\.(css|js)?${ expires 1h; } 2、压缩配置 gzip on gzip_min_length 1 阅读全文
posted @ 2016-03-01 15:27 北京流浪儿 阅读(240) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示