正在显示
1 个修改的文件
包含
10 行增加
和
3 行删除
@@ -372,19 +372,26 @@ public function websiteHtmlHandle($zip_count, $domain) | @@ -372,19 +372,26 @@ public function websiteHtmlHandle($zip_count, $domain) | ||
372 | */ | 372 | */ |
373 | public function downLoadFile($url) | 373 | public function downLoadFile($url) |
374 | { | 374 | { |
375 | + // 创建一个流上下文,设置 SSL 选项 | ||
376 | + $context = stream_context_create([ | ||
377 | + "ssl" => [ | ||
378 | + "verify_peer" => false, // 不验证对等证书 | ||
379 | + "verify_peer_name" => false, // 不验证对等证书名称 | ||
380 | + ], | ||
381 | + ]); | ||
375 | $savePath = public_path(); | 382 | $savePath = public_path(); |
376 | if (!file_exists($savePath)) { | 383 | if (!file_exists($savePath)) { |
377 | mkdir($savePath, 0777, true); | 384 | mkdir($savePath, 0777, true); |
378 | } | 385 | } |
379 | $targetFile = $savePath . '/' . basename($url); | 386 | $targetFile = $savePath . '/' . basename($url); |
380 | if (!file_exists($targetFile)) { | 387 | if (!file_exists($targetFile)) { |
381 | - $file = fopen($targetFile, 'w'); | 388 | + $file = fopen($targetFile, 'w', false, $context); |
382 | fclose($file); | 389 | fclose($file); |
383 | chmod($targetFile, 0755); | 390 | chmod($targetFile, 0755); |
384 | } | 391 | } |
385 | 392 | ||
386 | - $remoteFile = fopen($url, 'rb'); | ||
387 | - $localFile = fopen($targetFile, 'wb'); | 393 | + $remoteFile = fopen($url, 'rb', false, $context); |
394 | + $localFile = fopen($targetFile, 'wb', false, $context); | ||
388 | if ($remoteFile && $localFile) { | 395 | if ($remoteFile && $localFile) { |
389 | while (!feof($remoteFile)) { | 396 | while (!feof($remoteFile)) { |
390 | fwrite($localFile, fread($remoteFile, 1024 * 8), 1024 * 8); | 397 | fwrite($localFile, fread($remoteFile, 1024 * 8), 1024 * 8); |
-
请 注册 或 登录 后发表评论