Yii 时间日期组件与composer 下载中出现的问题

首先本篇主要讲3点

  • 一个Yii时间日期组件的两种用法

  • 笔者使用composer下载该组件时出现问题的解决办法

1、composer下载出现的问题


file could not be downloaded: failed to open stream: 由于连接方在 一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
猜想是网络问题【具体原因没懂,欢迎大神留言论述】解决办法:切换移动手机热点,就可以了!

2、时间日期(有日期有时间的:如1970-01-01 12:00:00)

composer下载 composer require kartik-v/yii2-widget-datetimepicker "*"

用法

`echo $form->field($model,'birth_day')
            ->label("生日")
            ->widget(DateTimePicker::classname(),[
                'options' => ['placeholder' => Yii::$app->user->identity->birth_day],
                'pluginOptions' => [
                    'autoclose' => true,
                    'todayHighlight' => true,
                    'format' => 'yyyy-mm-dd h:i:s',
                    ]
                ]);`

3、日期组件(只有日期:如1970-01-01)

composer下载 'composer require kartik-v/yii2-widget-datepicker "@dev"'

用法

`echo $form->field($model,'birth_day')
                ->label("生日")
                ->widget(DatePicker::classname(),[
                    'options' => ['placeholder' => Yii::$app->user->identity->birth_day],
                    'pluginOptions' => [
                        'autoclose' => true,
                        'todayHighlight' => true,
                        'format' => 'yyyy-mm-dd',
                        ]
                    ]);`

原文地址:https://segmentfault.com/a/1190000015844273

猜你喜欢

转载自www.cnblogs.com/lalalagq/p/9975560.html
yii
今日推荐