首先引入SDK
//请在此填入AppID与AppKey $app_id = 'xxxx'; $app_key = 'xxxxx'; //设置AppID与AppKey Configer::setAppInfo($app_id, $app_key); // 文本翻译(AI Lab) $params = array( 'type' => '0', 'text' => '我是谁', ); $response = API::texttrans($params); //var_dump($response); echo $response;
输出结果:
{ "ret": 0, "msg": "ok", "data": { "type": 0, "org_text": "我是谁", "trans_text": "Who am i?" } }