post('text'); $textArray = empty($textArray) ? null : json_decode($textArray, true); if (empty($textArray)) { return $this->error('参数text不可为空且必须为json数组'); } if(is_array($textArray)){ foreach ($textArray as $i => $text) { try{ $textArray[$i] = Jieba::cut($text); }catch (\Exception $e){ $this->log("cut {$text} error,reason:".$e->getMessage()); $textArray[$i] = [$text]; } } } return $this->success($textArray); } }