: This article mainly introduces the yii2 framework using drop-down menu of automatic search yii-widget-select2 instance analysis, for PHP tutorials interested in students can refer. This article describes how to use the drop-down menu to automatically search for yii-widget-select2 in the yii2 framework. We will share this with you for your reference. The details are as follows:
Github source code address: https://github.com/kartik-v/yii2-widget-select2
Install this plug-in using composer. phar:
Php composer. phar require kartik-v/yii2-widget-select2 "*"
Reference method:
Use kartik \ select2 \ Select2;
Source code:
<? = $ Form-> field ($ model, 'Companies _ company_id ')-> widget (Select2: classname (), ['data' => ArrayHelper: map (companies:: find ()-> all (), 'company _ id', 'company _ name'), 'language' => 'en ', 'options' => ['holder' => 'Select a state... '], 'ininoptions' => ['allowclear' => true],]);?>
A detailed explanation of related content: http://demos.krajee.com/widget-details/select2
I hope this article will help you design PHP programs based on the Yii Framework.
The above introduces the yii2 framework using the drop-down menu of automatic search yii-widget-select2 instance analysis, including the content of the aspect, hope to be interested in PHP Tutorial friends help.