
yii
yang_ldgd
这个作者很懒,什么都没留下…
展开
-
YII2 rageframe2 添加swoole进程
YII2 rageframe2 添加swoole进程原创 2022-09-14 15:04:41 · 332 阅读 · 0 评论 -
yii2 redis 常用操作
<?php Yii::$app->redis->set('user','aaa');Yii::$app->redis->set('user2','bbb');Yii::$app->redis->set('user3','ccc');Yii::$app->redis->set('user4','ddd');Yii::$app->Yii->$app->redis->expire('sms:send:' . $mobile,转载 2022-04-19 17:11:33 · 1046 阅读 · 0 评论 -
rageframe2 SearchModel 关联查询
控制器代码 $searchModel = new SearchModel([ 'model' => CreditsLog::class, 'scenario' => 'default', 'partialMatchAttributes' => ['realname', 'member.mobile', 'member_id'], // 模糊查询 'defaultOrder' => [原创 2022-03-10 16:09:34 · 265 阅读 · 0 评论 -
yii框架数据库操作
查一条数据$model = new Merchant();$merchant_id = Yii::$app->request->get('merchant_id');$data = $model::find()->where(['id'=>$merchant_id])->one();原创 2021-08-26 13:58:21 · 299 阅读 · 0 评论 -
rageframe2(基于yii)WebSocket前端使用
rageframe2开启websocket# 启动 php ./yii websocket/start# 停止 php ./yii websocket/stop# 重启 php ./yii websocket/restart前端请求代码<script> var wsl = 'ws://[to/your/url]:9501'; // 如果是wss的改成wss://[to/your/url]:9501 ws = new WebSocket(wsl);// 新建立一个原创 2021-08-25 09:59:19 · 377 阅读 · 0 评论 -
rageframe2(基于yii框架)的服务层 Server使用
配置如果需要新服务层调用方法 请在 services\Application 中的 childService 添加,例如:/** * @var array */public $childService = [ 'example' => [ 'class' => 'services\example\ExampleService', // 子服务 'childService' => [ 'rule' =&原创 2021-08-25 09:57:38 · 313 阅读 · 0 评论 -
yii框架前端方法
foreach遍历<?php foreach ($countries as $country): ?> <li> <?= Html::encode("{$country->name} ({$country->code})") ?>: <?= $country->population ?> </li><?php endforeach; ?>原创 2021-08-24 11:47:34 · 255 阅读 · 1 评论 -
yii框架数据库model
//能操作数据库的modelnamespace app\models;use yii\db\ActiveRecord;class Country extends ActiveRecord{}use app\models\Country;// 获取 country 表的所有行并以 name 排序$countries = Country::find()->orderBy('name')->all();// 获取主键为 “US” 的行$country = Country::f原创 2021-08-24 11:25:49 · 193 阅读 · 0 评论