The example in this article describes the YII2 Framework reference bootstrap in the date plug-in Yii2-date-picker method. Share to everyone for your reference, as follows:
Recently in the Learning YII2 framework, the framework was found to be powerful and combined with many new technologies in the present.
Simply record how the Yii2-date-picker plugin is used:
First look at the related resources in GitHub: Https://github.com/2amigos/yii2-date-picker-widget
Second: Download this resource in your own project using the related methods in the link above, and the command is:
PHP Composer.phar require "2amigos/yii2-date-picker-widget" "*"
Finally, use the following code in the view file:
Use Dosamigos\datepicker\datepicker;
Two methods are available in the example:
Method 1. Use widget mode
<?= datepicker::widget ([ ' model ' = $model, ' attribute ' = ' date ', ' template ' = ' {addon}{ Input} ', ' clientoptions ' = [ ' autoclose ' = ' = ', ' format ' = ' dd-m-yyyy ' ]]; >
Method 2. ActiveForm Way
<?= $form->field ($model, ' Date ')->widget ( datepicker::classname (), [ //inline too, not bad ' Inline ' = ' and true, //modify template for custom rendering ' template ' = ' {input} ', ' clientoptions ' = > [ ' autoclose ' = true, ' format ' = ' dd-m-yyyy ' ]]; >
It is hoped that this article is helpful to the PHP program design based on YII framework.
The above describes the YII2 framework reference bootstrap in the date plug-in Yii2-date-picker method, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.