1.注册deepseek并新建密钥

2 php服务端代码
$json = file_get_contents('php://input');
$jsonData = json_decode($json, true);
$datas= ['model'=>'deepseek-chat',
'messages'=>[
['role'=>'user','content'=>$jsonData['content']]
],
'stream'=>true
];
send('https://api.deepseek.com/chat/completions',$datas,'handleResponseData');
function send(string $url,$postdata,callable $callback){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 返回结果而不是直接输出
$headers = [
"Content-Type: application/json", // 设置内容类型为JSON
"Authorization: Bearer sk-69**************9d" // 设置认证头信息,例如Bearer Token
];
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // 设置头信息
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST