我正在使用谷歌翻譯(基本版)來翻譯一些字符串。幾分鐘前它工作正常,但現在它只返回錯誤 400。代碼非常簡單:function translatePhrase($text, $target, $source = 'it') { $sourceLanguage = $source; $targetLanguage = $target; $translate = new TranslateClient(); $result = $translate->translate($text, [ 'source' => $sourceLanguage, 'target' => $targetLanguage, ]); $output = $result['text']; return $output;}它返回:Uncaught Google\Cloud\Core\Exception\BadRequestException: {"error": {"code": 400,"message": "Invalid Value","errors": [{"message": "Invalid Value","domain": "global","reason": "invalid"}]}}in \vendor\google\cloud-core\src\RequestWrapper.php:362Stack trace:#0 \vendor\google\cloud-core\src\RequestWrapper.php(206): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\ClientException))#1 \translate\vendor\google\cloud-core\src\RestTrait.php(95): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array)#2 \translate\vendor\google\cloud-translate\src\V2\Connection\Rest.php(83): Google\Cloud\Translate\V2\Connection\Rest->send('translations', 'translate', Array)#3 \translate\vendor\google\cloud-translate\src\V2\TranslateClient.php(248): Google\Cloud\Translate\V2\Connection\Rest->listTrain [\translate\vendor\google\cloud-core\src\RequestWrapper.php riga 362]有什么想法嗎 ?
谷歌云翻譯:神秘錯誤 400 無效值
慕婉清6462132
2022-07-02 15:54:27