|
|
@@ -281,36 +281,10 @@ class IndexController extends HomeBaseController
|
|
|
public function clearCache(){
|
|
|
// 清楚Redis缓存
|
|
|
RedisService::delByKeys('cache:*');
|
|
|
+ exit('清除成功');
|
|
|
// end
|
|
|
}
|
|
|
|
|
|
- public function test(){
|
|
|
-// exit;
|
|
|
- set_time_limit(0);
|
|
|
- $content = file_get_contents('./logs/168.html');
|
|
|
-// $content = file_get_contents('http://www.1688cypt.com/');
|
|
|
-
|
|
|
- preg_match_all('/(href|src|data-src)=([\"|\']?)([^\"\'>]+.(jpg|JPG|jpeg|JPEG|gif|GIF|png|PNG))/i', $content, $result);
|
|
|
- $imgs = isset($result[3])? $result[3] : [];
|
|
|
- foreach ($imgs as $img){
|
|
|
- $img = str_replace('https:','http:', $img);
|
|
|
- $paths = parse_url($img);
|
|
|
- $filename = isset($paths['path'])? $paths['path'] : '';
|
|
|
- $path = $filename? './xm12/'.dirname($filename) : '';
|
|
|
- echo '抓取到图片:'."<br>";
|
|
|
- if($filename && !file_exists('./xm12/'.$filename) ){
|
|
|
- $content = file_get_contents('http://www.91jmls.com/'.$img);
|
|
|
- if($content){
|
|
|
- if(!is_dir($path)){
|
|
|
- @mkdir($path, 0755, true);
|
|
|
- }
|
|
|
-
|
|
|
- echo "下载保存图片:".'./imgs'.$filename."<br>";
|
|
|
- file_put_contents('./xm12/'.$filename, $content);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
?>
|