一个简单的ping搜索引擎类
* @author xiaoyu <614422099@qq.com>
* @time 2013年6月15日14:58:49
定义一个ping函数
/**
+----------------------------------------------------------
* 功能:Ping函数
+----------------------------------------------------------
* @param array
+----------------------------------------------------------
* @return empty
+----------------------------------------------------------
*/
function Ping($config=array()) {
import('ORG.Util.Ping', LIB_PATH);
$Conf = array(//'siteName' => '小雨博客',
'siteUrl' => 'http://'.$_SERVER["HTTP_HOST"].'/',//站点域名
//'updateUrl' => '',//ping给百度等的地址,外部必须提供
'updateRss' => 'http://'.$_SERVER["HTTP_HOST"].'/rss',//rss地址
);
$RssConf = array_merge($Conf ,$config);//将外部参数和定义参数合并
$PING = new Ping($RssConf);
$PING->execute();
unset($config,$Conf,$RssConf);
}
这样就可以在需要的地方使用ping函数
$config = S('Config');
$blogUrl = getBlogUrl($list);
Ping(array('updateUrl'=>$blogUrl,'siteName' =>$config['blogName']));
类说明:
一个简单的ping类,暂只支持百度和谷歌,传参方式和tp官方扩展类相似:
方式一:
$Conf = array(//'siteName' => '小雨博客',
'siteUrl' => 'http://'.$_SERVER["HTTP_HOST"].'/',//站点域名
//'updateUrl' => '',//ping给百度等的地址,外部必须提供
'updateRss' => 'http://'.$_SERVER["HTTP_HOST"].'/rss',//rss地址
);
$PING = new Ping($Conf );
$PING->execute();方式二: $PING = new Ping($Conf );
$PING->siteUrl = 'http://'.$_SERVER["HTTP_HOST"].'/';
$PING->execute();欢迎反馈!