
if (strpos($employee['avatar'], 'http') !== false) {
// 获取https头像 取消ssl验证
$arrContextOptions = [
"ssl" => [
"verify_peer"=>false,
"verify_peer_name"=>false,
],
];
// 远程绝对路径 上传到cdn
$path = "uploads/ueditor/image/default/" . date("Ym/d", time()) . '0_' . time() . '_' . str_random(10) . '.png';
$path = ImageUploadHandler::uploadFileStreamToCdn($path, file_get_contents($employee['avatar'], false, stream_context_create($arrContextOptions)));
}
本文介绍了一种从远程服务器获取HTTPS头像并取消SSL验证的方法,通过使用PHP的file_get_contents函数结合stream_context_create进行操作,最终将获取的图片上传到CDN中。
2774

被折叠的 条评论
为什么被折叠?



