As the title says,
$data = $textArray['content'];// 是个字符串
$params = array('top_k'=>10);
$ch = curl_init();
curl_setopt_array($ch,
CURLOPT_POSTFIELDS => json_encode($data,$params,JSON_UNESCAPED_UNICODE),
));// 这里其他部分省略了
This is what I wrote
But when printing json_encode($data,$params,JSON_UNESCAPED_UNICODE), it is found to be empty
Then write CURLOPT_POSTFIELDS => json_encode($data,JSON_UNESCAPED_UNICODE),json_encode($params,JSON_UNESCAPED_UNICODE),
This way we find that $params is not passed
Please answer, thank you
Method 1
Method 2
Variation of method 2
Method 3 Simple version
That’s it. . . .
I find that you don’t even know the basics of php. .