function BlogRequest($line){
$line=str_replace("&",'&',$line);
if(empty($line)){
return false;
}else{
$subject = file_get_contents(trim($line));
$regex = "/(([^<>]+))/ism";
preg_match_all($regex,$subject,$blogArray);
$i=3;
$sqlValue=array();
foreach($blogArray[0] as $k=>$v){
$sqlValue[]=explode('',$blogArray[0][$i]);
$i++;
}
foreach($sqlValue as $k=>$v){
foreach($v as $key=>$value){
$changeStr=$value;//内容不变真接存入数组
if($key==1){//图片只需地址
$changeStr=strip_tags(str_replace("alt=",'',preg_replace("/<img[^\]?([^\'"\s]*)['"]?/is",'',$value)));
}
$minAgo=1;
if($key==2){//在日期中分离一个链接地址出来
$timeStr=explode('span',$value);
$changeStr=str_replace('class="weiboShow_mainFeed_listContent_actionTime"','',$timeStr[1]);//发布时间
if(substr_count($changeStr,'分钟前')>0){
$oldmin=str_replace('分钟前','',trim(str_replace('>','',str_replace('"','',strip_tags($changeStr)))));
$nowmin=date('i',time());
$nowHore=date('H',time());
if($oldmin>$nowmin){
$fmin=$nowmin+60-$oldmin;
$nowHore=$nowHore-1;
$changeStr=date('Y-m-d ',time()).$nowHore.":".$fmin;
}else{
$fmin=$nowmin-$oldmin;
$changeStr=date('Y-m-d ',time()).$nowHore.":".$fmin;
}
$minAgo=2;
}else{
if(substr_count($changeStr,'今天')>0){
$changeStr=date('Y-m-d',time()).str_replace("今天",'',$changeStr);
}else{
$changeStr=date('Y-',time()).str_replace("日",' ',str_replace(" ",'',str_replace("月",'-',$changeStr)));
};
}
//该博客链接 正则
preg_match('/(?','',str_replace('"','',strip_tags($changeStr))));
if($key==2){
$sqlValue[$k][$key]=date('Y-m-d H:i',strtotime($sqlValue[$k][$key]));
}
}
}
}
return $sqlValue;
}
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号