08 2018 档案

yii2 restful HttpHeaderAuth header 请求发送参数
摘要:控制器添加 public function behaviors(){ $behaviors = parent::behaviors(); $behaviors['authenticator'] = [ 'class' => HttpBearerAuth::className(), ]; return 阅读全文

posted @ 2018-08-21 11:44 少杨 阅读(1772) 评论(0) 推荐(0)

yii2 各种组件中格式化时间 如:DetailView
摘要:views 视图文件中使用'updated_at:datetime',配置文件:main.php 'components' => [ 'formatter' => [ 'class' => 'yii\i18n\Formatter', 'dateFormat' => 'php:Y-m-d H:i:s' 阅读全文

posted @ 2018-08-03 17:04 少杨 阅读(495) 评论(0) 推荐(0)

yii2 droplist sql语句获取数组
摘要:$data = \api\models\Banner::find()->select("name,id")->indexBy("id")->column();如: <?= $form->field($model, 'banner_id')->dropDownList(\api\models\Bann 阅读全文

posted @ 2018-08-02 10:51 少杨 阅读(187) 评论(0) 推荐(0)