使用官方demo中的curl请求方式,出现以下情况
参数确保正确,在postman里测试正常,但是使用PHP,调用CURL方式,却一直出现这个错误
<html>
<head>
<title>PHP 测试</title>
</head>
<body>
<?php
$arr = array(‘path’=>‘pages/index/index’ , ‘scene’=>‘helloworld’);
$content = json_encode($arr);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array(“Content-type: application/json”));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
echo ‘<p>’ + strlen($json_response) + ‘</p>’;
?>
</body>
</html>
不能,参数用scene字段来传递