This commit is contained in:
2025-06-25 11:33:39 +08:00
parent 7b517cdc48
commit 00b365a13a
+3 -2
View File
@@ -53,7 +53,8 @@ class Xunfei
//在控制台-我的应用-机器翻译获取 //在控制台-我的应用-机器翻译获取
$api_key = "b6d805f240176ecaea85130cb5f2bca1"; $api_key = "b6d805f240176ecaea85130cb5f2bca1";
// 机器翻译接口地址 // 机器翻译接口地址
$url = "https://ntrans.xfyun.cn/v2/ots"; // $url = "https://ntrans.xfyun.cn/v2/ots";
$url = "https://114.118.75.150/v2/ots";
// $url = "http://ntrans.example.cn"; // $url = "http://ntrans.example.cn";
//body组装 //body组装
// $text = "中华人民共和国于1949年成立";//待翻译文本 // $text = "中华人民共和国于1949年成立";//待翻译文本
@@ -115,7 +116,7 @@ digest: %s", "ntrans.xfyun.cn", $date, $digestBase64);
{ {
try { try {
$res = $this->xfyun($text, $from, $to); $res = $this->xfyun($text, $from, $to);
log::error('fanyi_res',[$res]); // log::error('fanyi_res',[$res]);
$data = json_decode($res["body"], true); $data = json_decode($res["body"], true);
if ($data["code"] === 0) { if ($data["code"] === 0) {
return $data["data"]["result"]; return $data["data"]["result"];