1.
use SphinxClient;
2.
require('sphinxapi.php'); //引入类
$sphinx = new SphinxClient(); //实例化
$sphinx->setServer('127.0.0.1',9312);
$re = $sphinx->Query('技术','*');
$data = $re['matches'];
foreach($data as $k => $v){
$arr[] = Job::find()->where(['id' => $k ])->asArray()->one();
}
foreach($arr as $k => $v){
$arr[$k] = str_replace('技术',"<font color='red'>技术</font>", $v);
}
print_r($arr);die;