request->get('title'); $description = Yii::$app->request->get('description'); if(!empty($title)||!empty($description)) { $tags = []; $tagResultList = Tag::find()->where("disabled=0")->all(); if(is_array($tagResultList))foreach($tagResultList as $tagResult) { if(!empty($title)&&strpos($title,$tagResult->tag)!==false) $tags[] = $tagResult->tag; if(!empty($description)&&strpos($description,$tagResult->tag)!==false) $tags[] = $tagResult->tag; } $msgdata = [ 'error' => 0, 'msg' => '请求成功', 'data'=>['tags'=>join(",",array_unique($tags))], 'code'=>'200', ]; } else { $msgdata = [ 'error' => 1, 'msg' => '请求出错了', 'data'=>[], 'code'=>'200', ]; } return $msgdata; } }