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