摘要:
由于需要,要写一个简单的PHP采集程序,照例是到网上找了一堆教程,然后照猫画虎,可是发现网上的教程全是似是而非,没有一个真正能用的。苦想了几天,终于弄明白了里面的道理。在这里写出来,请高手指正。采集程序的思路很简单,无非就是先打一个页面,一般都是列表页,取得里面全部链接的地址,然后打开逐条链接,寻找我们感兴趣的东西,如果找到,就把它入库或别的处理。下面以一个很简单的例子来说说。首先确定一个采集页,一般就是列表面了。这里目标是:http://www.php100.com/article/11/index.htm。这 是一个列表页,我们的目的就是采集这个列表页上全部的文章。有列表页了,第一步先打开 阅读全文
随笔档案-2011年5月28日
Google翻译PHP接口
2011-05-28 14:06 by 卫佳, 669 阅读, 收藏,
摘要:
* 注意:如果翻译文本为UTF-8编码,则要删去mb_convert_encoding函数*/class Google_API_translator {public $url =“http://translate.google.com/translate_t”;public $text = “”;//翻译文本public $out = “”; //翻译输出function setText($text){$this->text = $text;}function translate() {$this->out = “”;$gphtml = $this->postPage($th 阅读全文
PHP单引号和双引号的区别
2011-05-28 14:06 by 卫佳, 203 阅读, 收藏,
摘要:
单引号内部的变量不会执行 双引号会执行如$name ='hello';echo "the $name";// cufflinks wholesale 会输出 thehello 而如果是单引号 $name ='hello'; echo 'the$name'; 会输出 the$name 主要区别就是这个。 阅读全文
应用ThinkPHP内置的分表算法处理百万级用户数据.
2011-05-28 14:05 by 卫佳, 862 阅读, 收藏,
摘要:
数据表: house_member_0 house_member_1 house_member_2 house_member_3 模型中//wedding jewelry wholesale classMemberModel extends AdvModel { protected$partition = array('field'=>'username','type'=>'id','num'=>'4'); publicfunction getDao($data=array()) 阅读全文
浙公网安备 33010602011771号