文章来源(hbsjsd.cn)湖北高端网站定制开发公司-速建时代
php 阿里云oss图片上传报错 RequestCoreException ssl 证书报错处理?
错误很明显,SSL证书 验证的问题,本地证书没有配置。如果看问题,配置证书是解决问题的办法,但是如果不想配置证书能否解决,当然可以。
// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为 $endpoint = "yourEndpoint";
如果按照上面方式在域名前添加http/https就会出现 RequestCoreException ssl证书报错处理?
方法一 返回为http
去除http/https就可以了,返回地址为 http,如何需要返回https地址需要如下操作
["url" => "http://oss-cn-zhangjiakou.aliyuncs.com/33/20230211/foot%20%281%29.png"]
方法二 返回为https地址
// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。 $endpoint = "yourEndpoint";
$endpoint 设置 https+域名
在证书的SDK中找到 src/OSS/Http/RequestCore.php 文件,找到下面代码
/** * The state of SSL certificate verification. */ public $ssl_verification = true;
修改为 false 即可 获取返回地址为
["url" => "https://oss-cn-zhangjiakou.aliyuncs.com/33/20230211/foot%20%281%29.png"]
[声明]原创不易,请转发者备注下文章来源(hbsjsd.cn)【速建时代】。