<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.movoin.com/styles/feedsky8.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.movoin.com" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/movoin" type="application/rss+xml"></fs:self_link><lastBuildDate>Mon, 04 Jul 2011 07:16:25 GMT</lastBuildDate><title>Movoin Studio</title><description>专注于PHP技术,PYTHON技术,WEB开发设计,程序设计</description><image><url>http://www.feedsky.com/feed/movoin/sc/gif</url><title>Movoin Studio</title><link>http://www.movoin.com</link></image><link>http://www.movoin.com</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><xhtml:meta name="robots" content="noindex"></xhtml:meta><xhtml:meta name="robots" content="noindex"></xhtml:meta><language>en</language><pubDate>Wed, 14 Dec 2011 04:02:54 GMT</pubDate><item><title>笔记本共享本地连接为Wifi信号</title><link>http://item.feedsky.com/~feedsky/movoin/~7583469/586938994/1236733/1/item.html</link><content:encoded>&lt;p&gt;网上有很多类似标题的文章，大多是讲手机连接上电脑，让电脑通过手机上网，这个太贵了吧！！！现在谁家里没网线，至于那么干吗？&lt;br /&gt;
其实我说这句话的时候，自己都觉得惭愧，因为我家就没网线，只有一个电信3G上网卡，100块包60个小时。PS：上个月还没用完，浪费了一半时间，伤不起呀！&lt;/p&gt;
&lt;p&gt;说明一下，这种方法可以适用范围有：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;
1，有线连接转Wifi信号；&lt;br /&gt;
2，3G上网信号转Wifi信号。
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;以上两种是我亲测的，3G上网环境是当我回到花场时用的；而有线连接环境是我在公司用的，公司的无线路由在另外的办公室，离我办公室很远，信号非常的差~~~&lt;/p&gt;
&lt;p&gt;步骤如下：&lt;/p&gt;
&lt;p&gt;1，开始菜单中搜索cmd，最好把它发送到桌面快捷方式，因为需要用管理员权限。&lt;br /&gt;
2，用管理员权限打开cmd，输入第一条命令：&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;sh_shell&quot; linenum=&quot;off&quot;&gt;netsh wlan set hostednetwork mode=allow&lt;/pre&gt;
&lt;p&gt;3，接着，就是下面这条命令：&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;sh_shell&quot; linenum=&quot;off&quot;&gt;netsh wlan set hostednetwork ssid=AllenWifi key=1234567890&lt;/pre&gt;
&lt;p&gt;（ssid=Wifi连接名称 key=密码）&lt;/p&gt;
&lt;p&gt;4，确定你笔记本上的无线网卡已经开启后，输入这条命令：&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;sh_shell&quot; linenum=&quot;off&quot;&gt;netsh wlan start hostednetwork&lt;/pre&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8211;&gt; 华丽的分割线 &lt; OK，到这里就已经算是完成了90%了。&lt;/p&gt;
&lt;p&gt;5，点击右下角的网卡图标，打开“打开网络和共享中心”，如无意外，你应该可以看到你刚刚建立的“AllenWifi”和“本地连接”。如果看不到那下面的你就不用弄了，也不用来问我，因为我也闹不明白！&lt;br /&gt;
（此时你所看到的AllenWifi还是无Internet状态）&lt;/p&gt;
&lt;p&gt;6，点击“本地连接” -&gt; “属性” -&gt; “共享”，在“家庭网络连接”中选择“AllenWifi”对应的适配器名称（如：无线网络连接 2），再勾选上面的复选框，确定。&lt;/p&gt;
&lt;p&gt;此时回到“打开网络和共享中心”，你应该可以看到你的“AllenWifi”已经是Internet了。&lt;/p&gt;
&lt;p&gt;打开你手机或用其它笔记本搜索一下网络试试吧！&lt;/p&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_shell.js&quot;&gt;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_shell.js&quot;&gt;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_shell.js&quot;&gt;&lt;/script&gt;&lt;h3  class=&quot;related_post_title&quot;&gt;既然来了，也许你也会想看一下：&lt;/h3&gt;&lt;ul class=&quot;related_post&quot;&gt;&lt;li&gt;看来这是个孤独的家伙！&lt;/li&gt;&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/586938994/movoin/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/movoin/~7583469/586938994/1236733/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.movoin.com/internet-to-wifi.html/feed/</wfw:commentRss><slash:comments>1</slash:comments><description>网上有很多类似标题的文章，大多是讲手机连接上电脑，让电脑通过手机上网，这个太贵了吧！！！现在谁家里没网线，至于那么干吗？ 其实我说这句话的时候，自己都觉得惭愧，因为我家就没网线，只有一个电信3G上网卡，100块包60个小时。PS：上个月还没用完，浪费了一半时间，伤不起呀！ 说明一下，这种方法可以适用范围有： 1，有线连接转Wifi信号； 2，3G上网信号转Wifi信号。 以上两种是我亲测的，3G上网环境是当我回到花场时用的；而有线连接环境是我在公司用的，公司的无线路由在另外的办公室，离我办公室很远，信号非常的差~~~ 步骤如下： 1，开始菜单中搜索cmd，最好把它发送到桌面快捷方式，因为需要用管理员权限。 2，用管理员权限打开cmd，输入第一条命令： netsh wlan set hostednetwork mode=allow 3，接着，就是下面这条命令： netsh wlan set hostednetwork ssid=AllenWifi key=1234567890 （ssid=Wifi连接名称 key=密码） 4，确定你笔记本上的无线网卡已经开启后，输入这条命令： netsh wlan start hostednetwork &amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8211;&gt; 华丽的分割线 &lt; OK，到这里就已经算是完成了90%了。 5，点击右下角的网卡图标，打开“打开网络和共享中心”，如无意外，你应该可以看到你刚刚建立的“AllenWifi”和“本地连接”。如果看不到那下面的你就不用弄了，也不用来问我，因为我也闹不明白！ （此时你所看到的AllenWifi还是无Internet状态） 6，点击“本地连接” -&gt; “属性” -&gt; “共享”，在“家庭网络连接”中选择“AllenWifi”对应的适配器名称（如：无线网络连接 2），再勾选上面的复选框，确定。 此时回到“打开网络和共享中心”，你应该可以看到你的“AllenWifi”已经是Internet了。 打开你手机或用其它笔记本搜索一下网络试试吧！ 既然来了，也许你也会想看一下：看来这是个孤独的家伙！&lt;img src=&quot;http://www1.feedsky.com/t1/586938994/movoin/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/movoin/~7583469/586938994/1236733/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Wifi</category><category>技巧整理</category><pubDate>Mon, 04 Jul 2011 15:16:25 +0800</pubDate><author>Allen</author><comments>http://www.movoin.com/internet-to-wifi.html#comments</comments><guid isPermaLink="false">http://www.movoin.com/?p=91</guid><dc:creator>Allen</dc:creator><fs:srclink>http://www.movoin.com/internet-to-wifi.html</fs:srclink><fs:srcfeed>http://movoin.com/feed</fs:srcfeed><fs:itemid>feedsky/movoin/~7583469/586938994/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-07-02]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-07-02</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-07-02</guid><pubDate>Sat, 02 Jul 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://www.laruence.com/2011/07/02/2097.html' title='link to ..'&gt;PHP5.4的新特性&lt;/a&gt;&lt;br/&gt;&lt;div&gt;

作者: Laruence(    )
本文地址: http://www.laruence.com/2011/07/02/2097.html

转载请注明出处 


     PHP5.3刚出来不久, PHP6孕育中的同时, PHP5.4又放出了第一个alpha版本.
     5.4主要包括以下特性:

Added: Traits language construct
Added: Array derefe..&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://www.laruence.com/2011/07/02/2097.html</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861479/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-06-26]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-06-26</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-06-26</guid><pubDate>Sun, 26 Jun 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://www.ooso.net/archives/548' title='link to ..'&gt;php文档更新&lt;/a&gt;&lt;br/&gt;&lt;div&gt;php.net最近更新了php文档，比较有用的是新增的pman工具。pman是一个命令行小工具，方便查看php函数的本地帮助文档，但是不包含php.net的评论数据。简单的试用心得如下:
安装pman
使用传说中的pear来安装pman
sudo pear install doc.php.net/pman
如果pear版本比较老..&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://www.ooso.net/archives/548</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861480/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-06-18]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-06-18</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-06-18</guid><pubDate>Sat, 18 Jun 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://www.osphp.com.cn/read.php/573.htm' title='link to ..'&gt;AjaXplorer php文件管理器&lt;/a&gt;&lt;br/&gt;&lt;div&gt;&lt;blockquote&gt;Shared by  Allen 
&lt;br&gt;
酷！！！&lt;/blockquote&gt;
&lt;strong&gt;官方网站：&lt;/strong&gt;http://ajaxplorer.info   / &lt;a href=&quot;http://sourceforge.net/projects/ajaxplorer&quot;&gt;http://sourceforge.net/projects/ajaxplorer&lt;/a&gt;&lt;br&gt;&lt;strong&gt;演示地址：&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;下载地址：&lt;/strong&gt;http://sourceforge.net/projects/ajaxplorer&lt;br&gt;&lt;strong&gt;文章来源：http://www.OSphp.com.cn&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;程序介绍：&lt;/strong&gt;&lt;br&gt;php文件管理器&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.osphp.com.cn/attachment.php?fid=333&quot;&gt;&lt;img src=&quot;http://www.osphp.com.cn/attachment.php?fid=333&quot; alt=&quot;点击在新窗口中浏览此图片&quot; title=&quot;点击在新窗口中浏览此图片&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;br&gt;Tags - &lt;a href=&quot;http://www.osphp.com.cn/go.php/tags/php%25E6%2596%2587%25E4%25BB%25B6%25E7%25AE%25A1%25E7%2590%2586%25E5%2599%25A8/&quot; rel=&quot;tag&quot;&gt;php文件管理器&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://www.osphp.com.cn/read.php/573.htm</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861481/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-05-18]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-05-18</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-05-18</guid><pubDate>Wed, 18 May 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://article.yeeyan.org/view/184220/195474' title='link to ..'&gt;程序员的本质&lt;/a&gt;&lt;br/&gt;&lt;div&gt;原作者：来源What do programmers really do?译者伯乐在线                                                        　　Computers are useless. They can only give you answers. – Picasso 　　计算机没..&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://article.yeeyan.org/view/184220/195474</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861482/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-05-15]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-05-15</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-05-15</guid><pubDate>Sun, 15 May 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://article.yeeyan.org/view/jht/194828' title='link to ..'&gt;3个不那么明显但相当棒的网站管理员Xenu链接嗅探用法&lt;/a&gt;&lt;br/&gt;&lt;div&gt;原作者：来源3 Not-So-Obvious But Totally Awesome Uses Of Xenu Link Sleuth For Webmasters译者Louis Han3个不那么明显但相当棒的网站管理员Xenu链接嗅探用法[译文155]                                             ..&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://article.yeeyan.org/view/jht/194828</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861483/1236733</fs:itemid></item><item><title>PHP抓取天气预报</title><link>http://item.feedsky.com/~feedsky/movoin/~7583469/586938995/1236733/1/item.html</link><content:encoded>&lt;p&gt;最近遇到个项目，客户非要加个天气预报功能，还提出要求最少显示三天。到网上找了很多挂件都无法找到满足要求的，这可让老夫如何是好~~~于是乎被逼无耐下，自己写了这个抓取类。&lt;/p&gt;
&lt;p&gt;主要功能只是将所须省市的七天的天气抓取下来，目前我这个项目中应用了缓存，但因为是FLEA的缓存机制，所以把代码贴出来对不使用FLEA的同学完全没有帮助，所以就省了点代码。&lt;/p&gt;
&lt;p&gt;关于缓存方面，我个人比较倾向于按你读取的天数来确定缓存时间，比如：你一次只显示今天和明天的，那抓取来的七天数据就可以使用六次，直到七天数据用完的时候才需要重新抓取。&lt;/p&gt;
&lt;p&gt;如图：&lt;a href=&quot;http://www.movoin.com/wp-content/uploads/2011/05/cache.jpg&quot;&gt;&lt;img src=&quot;http://www.movoin.com/wp-content/uploads/2011/05/cache-300x125.jpg&quot; alt=&quot;cache 300x125 PHP抓取天气预报&quot; title=&quot;PHP抓取天气预报&quot; width=&quot;300&quot; height=&quot;125&quot; class=&quot;alignnone size-medium wp-image-90&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;这样处理缓存我个人觉得比较划算，呵呵。&lt;/p&gt;
&lt;p&gt;[PS]: &lt;strong&gt;贴代码是个辛苦活，记得以前有些几个网站是可以分享代码片段的，但忘了名字，有同学愿意告诉一下我吗？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-89&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;先上源码：&lt;/strong&gt;&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;sh_php&quot; linenum=&quot;off&quot;&gt;&amp;lt;?php
class Model_Weather
{
    private $_server = 'http://qq.ip138.com';
    private $_ext = '.htm';
    private $_province;
    private $_city;

    function __construct($province='guangdong', $city='zhongshan')
    {
        $this-&amp;gt;_province = $province;
        $this-&amp;gt;_city = $city;
    }

    function setServer($server)
    {
        $this-&amp;gt;_server = $server;
    }

    function setProvince($province)
    {
        $this-&amp;gt;_province = $province;
    }

    function setCity($city)
    {
        $this-&amp;gt;_city = $city;
    }

    function setExt($ext)
    {
        $this-&amp;gt;_ext = $ext;
    }

    function getPageLink()
    {
        return $this-&amp;gt;_server . '/weather/' .
               $this-&amp;gt;_province . '/' .
               $this-&amp;gt;_city .
               $this-&amp;gt;_ext;
    }

    function getIconLink($icon)
    {
        return $this-&amp;gt;_server . $icon;
    }

    // 最好是使用缓存，不然比较废时。
    function fetch($display = 3)
    {
        $weather = $this-&amp;gt;_fetch();

        for ($i=0; $i&amp;lt;$display; $i++)
        {
            $return[] = $weather[$i];
        }

        return $return;
    }

    function _fetch()
    {
        $content = $this-&amp;gt;fopen_url($this-&amp;gt;getPageLink());
        $match = $this-&amp;gt;find(&amp;quot;&amp;lt;table width=\&amp;quot;700\&amp;quot; borderColorDark=\&amp;quot;#ffffff\&amp;quot; borderColorLight=\&amp;quot;#008000\&amp;quot; border=\&amp;quot;1\&amp;quot; cellspacing=\&amp;quot;0\&amp;quot; cellpadding=\&amp;quot;1\&amp;quot; align=\&amp;quot;center\&amp;quot;&amp;quot;, &amp;quot;table&amp;gt;&amp;quot;, $content);

        $table = $this-&amp;gt;findAll(&amp;quot;&amp;lt;tr&amp;quot;, &amp;quot;tr&amp;gt;&amp;quot;, $match);

        $dates = $this-&amp;gt;getDate($table[0]);
        $icons = $this-&amp;gt;getIcons($table[1]);
        $temperatures = $this-&amp;gt;getTemperature($table[2]);

        foreach ($dates as $i =&amp;gt; $date)
        {
            $return[$i] = array(
                'date' =&amp;gt; explode(' ', $date),
                'icons' =&amp;gt; $icons[$i],
                'temperature' =&amp;gt; $temperatures[$i],
            );
        }

        return $return;
    }

    // 日期
    function getDate($table)
    {
        $dates = $this-&amp;gt;findAll(&amp;quot;&amp;lt;th class=\&amp;quot;tdc1\&amp;quot; style=\&amp;quot;white-space:nowrap;\&amp;quot;&amp;quot;, &amp;quot;td&amp;gt;&amp;quot;, $table);
        return array_map('strip_tags', $dates);
    }

    // 天气图标及文字
    function getIcons($table)
    {
        $tds = $this-&amp;gt;findAll(&amp;quot;&amp;lt;td&amp;quot;, &amp;quot;td&amp;gt;&amp;quot;, $table);

        array_shift($tds);
        foreach ($tds as $i =&amp;gt; $td)
        {
            $t = explode('&amp;lt;br/&amp;gt;', $td);
            $r1 = &amp;quot;/src=\&amp;quot;(.*?)\&amp;quot;/is&amp;quot;;
            preg_match_all($r1, $t[0], $icons);
            $icon = array_map(array($this, 'getIconLink'), $icons[1]);
            $rows[$i] = array(
                'text' =&amp;gt; strip_tags($t[1]),
                'images' =&amp;gt; $icon
            );
        }

        return $rows;
    }

    // 气温
    function getTemperature($table)
    {
        $dates = $this-&amp;gt;findAll(&amp;quot;&amp;lt;td&amp;quot;, &amp;quot;td&amp;gt;&amp;quot;, $table);
        array_shift($dates);
        return array_map('strip_tags', $dates);
    }

    function find($begin, $end, $content)
    {
        $match = '';
        $r = &amp;quot;/{$begin}(.*?){$end}/is&amp;quot;;
        preg_match($r, $content, $match);

        return $match[0];
    }

    function findAll($begin, $end, $content)
    {
        $matchs = '';
        $r = &amp;quot;/{$begin}(.*?){$end}/is&amp;quot;;
        preg_match_all($r, $content, $matchs);

        return $matchs[0];
    }

    function fopen_url($url)
    {
        if (function_exists('file_get_contents')) {
            $file_content = @file_get_contents($url);
        } elseif (ini_get('allow_url_fopen') &amp;amp;&amp;amp; ($file = @fopen($url, 'rb'))) {
            $i = 0;
            while (!feof($file) &amp;amp;&amp;amp; $i++ &amp;lt; 1000) {
                $file_content .= strtolower(fread($file, 4096));
            }
            fclose($file);
        } elseif (function_exists('curl_init')) {
            $curl_handle = curl_init();
            curl_setopt($curl_handle, CURLOPT_URL, $url);
            curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT,2);
            curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER,1);
            curl_setopt($curl_handle, CURLOPT_FAILONERROR,1);
            curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Trackback Spam Check'); //引用垃圾邮件检查
            $file_content = curl_exec($curl_handle);
            curl_close($curl_handle);
        } else {
            $file_content = '';
        }
        return iconv(&amp;quot;gb2312&amp;quot;, &amp;quot;utf-8&amp;quot;,$file_content);
    }

}
?&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;返回数据结构：&lt;/strong&gt;&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;sh_php&quot; linenum=&quot;off&quot;&gt;Array
(
    [0] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-6
                    [1] =&gt; 星期五
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 阴
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b2.gif
                        )
                )
            [temperature] =&gt; 27℃～22℃
        )
    [1] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-7
                    [1] =&gt; 星期六
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 多云
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b1.gif
                        )
                )
            [temperature] =&gt; 29℃～22℃
        )
    [2] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-8
                    [1] =&gt; 星期日
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 多云
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b1.gif
                        )
                )
            [temperature] =&gt; 30℃～23℃
        )
    [3] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-9
                    [1] =&gt; 星期一
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 阵雨
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b3.gif
                        )
                )
            [temperature] =&gt; 29℃～21℃
        )
    [4] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-10
                    [1] =&gt; 星期二
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 阵雨转多云
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b3.gif
                            [1] =&gt; http://qq.ip138.com/image/b1.gif
                        )
                )
            [temperature] =&gt; 27℃～21℃
        )
    [5] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-11
                    [1] =&gt; 星期三
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 多云
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b1.gif
                        )
                )
            [temperature] =&gt; 28℃～21℃
        )
    [6] =&gt; Array
        (
            [date] =&gt; Array
                (
                    [0] =&gt; 2011-5-12
                    [1] =&gt; 星期四
                )
            [icons] =&gt; Array
                (
                    [text] =&gt; 多云
                    [images] =&gt; Array
                        (
                            [0] =&gt; http://qq.ip138.com/image/b1.gif
                        )
                )
            [temperature] =&gt; 28℃
        )
)&lt;/pre&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js&quot;&gt;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_php.js&quot;&gt;&lt;/script&gt;&lt;h3  class=&quot;related_post_title&quot;&gt;既然来了，也许你也会想看一下：&lt;/h3&gt;&lt;ul class=&quot;related_post&quot;&gt;&lt;li&gt;2011/03/23 -- &lt;a href=&quot;http://www.movoin.com/yii-framework-source-code-to-read-notes-1.html&quot; title=&quot;Yii Framework 源码阅读笔记(述)&quot;&gt;Yii Framework 源码阅读笔记(述)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2011/01/18 -- &lt;a href=&quot;http://www.movoin.com/python-devel-spider.html&quot; title=&quot;Python编写蜘蛛/爬虫&quot;&gt;Python编写蜘蛛/爬虫&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/12/09 -- &lt;a href=&quot;http://www.movoin.com/fleaphp-in-php5-3.html&quot; title=&quot;FLEAPHP运行在PHP5.3+上的报错的解决办法&quot;&gt;FLEAPHP运行在PHP5.3+上的报错的解决办法&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/11/24 -- &lt;a href=&quot;http://www.movoin.com/my-confusion.html&quot; title=&quot;我最近的困惑&quot;&gt;我最近的困惑&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/08/20 -- &lt;a href=&quot;http://www.movoin.com/ckeditor-and-ckfinder-tips.html&quot; title=&quot;CKEditor + CKFinder 整合笔记&quot;&gt;CKEditor + CKFinder 整合笔记&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/586938995/movoin/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/movoin/~7583469/586938995/1236733/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.movoin.com/php-weather-class.html/feed/</wfw:commentRss><slash:comments>2</slash:comments><description>最近遇到个项目，客户非要加个天气预报功能，还提出要求最少显示三天。到网上找了很多挂件都无法找到满足要求的，这可让老夫如何是好~~~于是乎被逼无耐下，自己写了这个抓取类。 主要功能只是将所须省市的七天的天气抓取下来，目前我这个项目中应用了缓存，但因为是FLEA的缓存机制，所以把代码贴出来对不使用FLEA的同学完全没有帮助，所以就省了点代码。 关于缓存方面，我个人比较倾向于按你读取的天数来确定缓存时间，比如：你一次只显示今天和明天的，那抓取来的七天数据就可以使用六次，直到七天数据用完的时候才需要重新抓取。 如图： 这样处理缓存我个人觉得比较划算，呵呵。 [PS]: 贴代码是个辛苦活，记得以前有些几个网站是可以分享代码片段的，但忘了名字，有同学愿意告诉一下我吗？ 先上源码： &amp;#60;?php class Model_Weather { private $_server = 'http://qq.ip138.com'; private $_ext = '.htm'; private $_province; private $_city; function __construct($province='guangdong', $city='zhongshan') { $this-&amp;#62;_province = $province; $this-&amp;#62;_city = $city; } function setServer($server) { $this-&amp;#62;_server = $server; } function setProvince($province) { $this-&amp;#62;_province = $province; } function setCity($city) { $this-&amp;#62;_city = $city; [...]&lt;img src=&quot;http://www1.feedsky.com/t1/586938995/movoin/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/movoin/~7583469/586938995/1236733/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>爬虫</category><category>PHP</category><category>程序开发</category><pubDate>Fri, 06 May 2011 15:58:26 +0800</pubDate><author>Allen</author><comments>http://www.movoin.com/php-weather-class.html#comments</comments><guid isPermaLink="false">http://www.movoin.com/?p=89</guid><dc:creator>Allen</dc:creator><fs:srclink>http://www.movoin.com/php-weather-class.html</fs:srclink><fs:srcfeed>http://movoin.com/feed</fs:srcfeed><fs:itemid>feedsky/movoin/~7583469/586938995/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-04-07]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-04-07</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-04-07</guid><pubDate>Thu, 07 Apr 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://article.yeeyan.org/view/218991/185701' title='link to ..'&gt;了解用户体验背后的商业价值&lt;/a&gt;&lt;br/&gt;&lt;div&gt;原作者：来源Understand the Business Behind UX It’s Your Job | UX Magazine译者eulooo译：水宿鸟 多少次，你的辛勤工作因为“超出预算”而付诸东流？又有多少次，你感到失落、沮丧甚至丧失动力，因为不管你的设计和解决方案多么出色最后却根本不被施行？   作为U..&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://article.yeeyan.org/view/218991/185701</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861484/1236733</fs:itemid></item><item><title>我在读什么@GoogleReader [2011-03-25]</title><link>http://www.google.com/reader/shared/02081063612944962302#2011-03-25</link><guid>http://www.google.com/reader/shared/02081063612944962302#2011-03-25</guid><pubDate>Fri, 25 Mar 2011 00:00:00 +0800</pubDate><description>&lt;ul&gt;&lt;li&gt;&lt;a href='http://blog.redren.com/2011/03/googles-high-performance-manager-habits-8/' title='link to ..'&gt;谷歌高效能经理人的8个习惯&lt;/a&gt;&lt;br/&gt;&lt;div&gt;来源 8 Habits Of Highly Effective Google Managers    译者 sissi_chen
    Google’s &amp;quot;people operations&amp;quot; team (HR) has applied the Google Way (data analytics) to management analysis and developed a manifesto entitled Eight Habits Of High..&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description><fs:burntype>mark day</fs:burntype><fs:srclink>http://blog.redren.com/2011/03/googles-high-performance-manager-habits-8/</fs:srclink><fs:srcfeed>http://www.google.com/reader/public/atom/user/02081063612944962302/state/com.google/broadcast</fs:srcfeed><fs:itemid>feedsky/movoin/~7353715/635861486/1236733</fs:itemid></item><item><title>Yii Framework 源码阅读笔记(述)</title><link>http://item.feedsky.com/~feedsky/movoin/~7583469/586938996/1236733/1/item.html</link><content:encoded>&lt;p&gt;做PHP也蛮多年了，一直对国产各类系统、平台的二次开发不太感冒，主要都在研究一些框架自制系统、开放平台等。&lt;/p&gt;
&lt;p&gt;学习过CakePHP、CI、FleaPHP、QeePHP、ThinkPHP及Zend Framework，有些只是浅尝即止——指遇到一丁点不爽就放弃这个框架。&lt;/p&gt;
&lt;p&gt;1. CI不用说，太简单了，框架风格让我不爽，虽然我也信奉&amp;#8221;Simple is better&amp;#8221;，但是也不等于可以&amp;#8221;升级&amp;#8221;成&amp;#8221;Simple is Simple&amp;#8221;吧，我需要较强的定制性，而不是在你的XXOO里打混。&lt;br /&gt;
2. CakePHP很帅气，也很好用，但由于种种原因没有继续尝试。&lt;br /&gt;
3. FleaPHP是我用的最久的一套框架，直到我用到需要修改框架源码才放弃。&lt;br /&gt;
4. QeePHP是我觉得比较杯具的一套框架，瘳老板在开始时说的噼里啪啦的，可到执行时就扑哧扑哧没下文了。对它最不满的是文档，也不喜欢其社区的氛围，可能是什么样的老大会培养出什么样的小弟吧，瘳老板没事就在phpchina上和ThinkPHP的谁谁谁干上几场。所以社区里的小弟们也一个个的在各种条件下讨论哪个框架更好，真是没完没了。&lt;br /&gt;
5. ThinkPHP只是看过文档及小部分源码，不喜欢这种方式来编程，不再言语了。&lt;br /&gt;
6. Zend Framework，很牛叉即使你不使用它也能够从分析其源码中得到非常大的收获，是一个PHP5的标准源码示例库，但要用它嘛~~~我要再考虑考虑，我一个项目加上所有文件不过2M，你的框架就XXOO，太乳酸了~~~&lt;/p&gt;
&lt;p&gt;OK，放屁到此结束！&lt;/p&gt;
&lt;p&gt;其实尝试过的框架已经不记得有多少了，也不是一两百字就可以带过的，上面的就是个意思，全当放屁就行了，下面的才是正文。&lt;/p&gt;
&lt;p&gt;知道Yii还是在Qeephp的社区，那时的我正在热切的期盼着QeePHP的诞生，在这个过程中老瘳突然做起了调查，主要是问大家喜欢什么样的文档手册，并给出了参考，参考的就是YiiFramework，真是无语。&lt;/p&gt;
&lt;p&gt;开始时我也只是把注意力放在它的文档上，连跑个Demo都没试过。现在回想起来是多么的不应该呀，为了一团浮云而错过了驾驭一匹神马的机会。直到近期才抽时间去看源码，世界立即完全不同了。&lt;/p&gt;
&lt;p&gt;Yii的文档做得很不错，但我觉得还是不够详尽，想要更好的学习还是要从源码开始。但了解框架的结构还是足够了，想要更深入的学习框架本身则需要读懂它的源码。&lt;/p&gt;
&lt;p&gt;接下来就是动手(动眼)阅读代码了&amp;#8230;&lt;/p&gt;
&lt;p&gt;{EOF}&lt;/p&gt;
&lt;h3  class=&quot;related_post_title&quot;&gt;既然来了，也许你也会想看一下：&lt;/h3&gt;&lt;ul class=&quot;related_post&quot;&gt;&lt;li&gt;2010/12/09 -- &lt;a href=&quot;http://www.movoin.com/fleaphp-in-php5-3.html&quot; title=&quot;FLEAPHP运行在PHP5.3+上的报错的解决办法&quot;&gt;FLEAPHP运行在PHP5.3+上的报错的解决办法&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2011/05/06 -- &lt;a href=&quot;http://www.movoin.com/php-weather-class.html&quot; title=&quot;PHP抓取天气预报&quot;&gt;PHP抓取天气预报&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/11/24 -- &lt;a href=&quot;http://www.movoin.com/my-confusion.html&quot; title=&quot;我最近的困惑&quot;&gt;我最近的困惑&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/10/18 -- &lt;a href=&quot;http://www.movoin.com/html5-javascript-framework-for-mobile-applications.html&quot; title=&quot;手机应用的HTML5 JavaScript框架&quot;&gt;手机应用的HTML5 JavaScript框架&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/09/07 -- &lt;a href=&quot;http://www.movoin.com/10-useful-frameworks-to-develop-html-based-webapps-for-touch-devices.html&quot; title=&quot;10款基于Html的移动应用开发框架&quot;&gt;10款基于Html的移动应用开发框架&lt;/a&gt;&lt;/li&gt;&lt;li&gt;2010/08/20 -- &lt;a href=&quot;http://www.movoin.com/ckeditor-and-ckfinder-tips.html&quot; title=&quot;CKEditor + CKFinder 整合笔记&quot;&gt;CKEditor + CKFinder 整合笔记&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/586938996/movoin/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/movoin/~7583469/586938996/1236733/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.movoin.com/yii-framework-source-code-to-read-notes-1.html/feed/</wfw:commentRss><slash:comments>4</slash:comments><description>做PHP也蛮多年了，一直对国产各类系统、平台的二次开发不太感冒，主要都在研究一些框架自制系统、开放平台等。 学习过CakePHP、CI、FleaPHP、QeePHP、ThinkPHP及Zend Framework，有些只是浅尝即止——指遇到一丁点不爽就放弃这个框架。 1. CI不用说，太简单了，框架风格让我不爽，虽然我也信奉&amp;#8221;Simple is better&amp;#8221;，但是也不等于可以&amp;#8221;升级&amp;#8221;成&amp;#8221;Simple is Simple&amp;#8221;吧，我需要较强的定制性，而不是在你的XXOO里打混。 2. CakePHP很帅气，也很好用，但由于种种原因没有继续尝试。 3. FleaPHP是我用的最久的一套框架，直到我用到需要修改框架源码才放弃。 4. QeePHP是我觉得比较杯具的一套框架，瘳老板在开始时说的噼里啪啦的，可到执行时就扑哧扑哧没下文了。对它最不满的是文档，也不喜欢其社区的氛围，可能是什么样的老大会培养出什么样的小弟吧，瘳老板没事就在phpchina上和ThinkPHP的谁谁谁干上几场。所以社区里的小弟们也一个个的在各种条件下讨论哪个框架更好，真是没完没了。 5. ThinkPHP只是看过文档及小部分源码，不喜欢这种方式来编程，不再言语了。 6. Zend Framework，很牛叉即使你不使用它也能够从分析其源码中得到非常大的收获，是一个PHP5的标准源码示例库，但要用它嘛~~~我要再考虑考虑，我一个项目加上所有文件不过2M，你的框架就XXOO，太乳酸了~~~ OK，放屁到此结束！ 其实尝试过的框架已经不记得有多少了，也不是一两百字就可以带过的，上面的就是个意思，全当放屁就行了，下面的才是正文。 知道Yii还是在Qeephp的社区，那时的我正在热切的期盼着QeePHP的诞生，在这个过程中老瘳突然做起了调查，主要是问大家喜欢什么样的文档手册，并给出了参考，参考的就是YiiFramework，真是无语。 开始时我也只是把注意力放在它的文档上，连跑个Demo都没试过。现在回想起来是多么的不应该呀，为了一团浮云而错过了驾驭一匹神马的机会。直到近期才抽时间去看源码，世界立即完全不同了。 Yii的文档做得很不错，但我觉得还是不够详尽，想要更好的学习还是要从源码开始。但了解框架的结构还是足够了，想要更深入的学习框架本身则需要读懂它的源码。 接下来就是动手(动眼)阅读代码了&amp;#8230; {EOF} 既然来了，也许你也会想看一下：2010/12/09 -- FLEAPHP运行在PHP5.3+上的报错的解决办法2011/05/06 -- PHP抓取天气预报2010/11/24 -- 我最近的困惑2010/10/18 -- 手机应用的HTML5 JavaScript框架2010/09/07 -- 10款基于Html的移动应用开发框架2010/08/20 -- CKEditor + CKFinder 整合笔记&lt;img src=&quot;http://www1.feedsky.com/t1/586938996/movoin/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/movoin/~7583469/586938996/1236733/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>PHP</category><category>Yii</category><category>程序开发</category><category>框架</category><pubDate>Wed, 23 Mar 2011 16:58:39 +0800</pubDate><author>Allen</author><comments>http://www.movoin.com/yii-framework-source-code-to-read-notes-1.html#comments</comments><guid isPermaLink="false">http://www.movoin.com/?p=87</guid><dc:creator>Allen</dc:creator><fs:srclink>http://www.movoin.com/yii-framework-source-code-to-read-notes-1.html</fs:srclink><fs:srcfeed>http://movoin.com/feed</fs:srcfeed><fs:itemid>feedsky/movoin/~7583469/586938996/1236733</fs:itemid></item></channel></rss>
