关于qq小程序内容安全审核

qq小程序在提交审核的时候,如果没有加入内容安全接口,将不允许提交审核,提示如下:

加入qq内容安全审核的文档参考:
https://q.qq.com/wiki/develop/miniprogram/server/open_port/port_safe.html
值得注意是:使用php的curl方法访问内容安全接口的时候,需要设置header ,且header需要包括“Content-type: application/json” ,否则会导致提示“参数错误”
详细的代码如下:
function https_curl_post($url,$data,$type){
if($type=='json'){
$headers = array("Content-type: application/json;charset=UTF-8","Accept: application/json","Cache-Control: no-cache", "Pragma: no-cache"); //访问qq内容安全这句一定要加
$data=json_encode($data);
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)){
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS,$data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers ); //访问qq内容安全这句一定要加
$data = curl_exec($curl);
if (curl_errno($curl)){
return 'ERROR';
}
curl_close($curl);
return $data;
}