Stories

List
Create Time

Yii2 ElasticSearch aggregate (group)

我想要統計的是country_code 出現的次數,通過yii2的ElasticSearch擴展,上面的例子滿足我的需要。業務場景:在fecify商城中,使用elasticSearch搜索,進行aggregate group操作,代碼如下: public function actionCountry(){ $size = 5000; $name = 'country_code';

Create Time

Yii2 controller 傳值給layout

在yii2中,我們通過下面的方法,將controller的數組傳遞給view public function actionIndex() { $data = ['xx' = 'yy']; return $this-render($this-action-id,$data); } 在view文件中就可以使用$xx

Create Time

yii2 – redis 配置

安裝redis, 下面是2.8,注意,redis版本一定要高,2.2.7一下的版本是不行的,不支持php-redis,建議安裝2.8+的版本 wget http://download.redis.io/releases/redis-3.2.9.tar.gz tar xzf redis-3.2.9.tar.gz cd redis-3.2.9 make 2.6.14 這個版本有點老,大家可