• <i id='ZrDDu'><tr id='ZrDDu'><dt id='ZrDDu'><q id='ZrDDu'><span id='ZrDDu'><b id='ZrDDu'><form id='ZrDDu'><ins id='ZrDDu'></ins><ul id='ZrDDu'></ul><sub id='ZrDDu'></sub></form><legend id='ZrDDu'></legend><bdo id='ZrDDu'><pre id='ZrDDu'><center id='ZrDDu'></center></pre></bdo></b><th id='ZrDDu'></th></span></q></dt></tr></i><div id='ZrDDu'><tfoot id='ZrDDu'></tfoot><dl id='ZrDDu'><fieldset id='ZrDDu'></fieldset></dl></div>

      <tfoot id='ZrDDu'></tfoot>
      <legend id='ZrDDu'><style id='ZrDDu'><dir id='ZrDDu'><q id='ZrDDu'></q></dir></style></legend>

      • <bdo id='ZrDDu'></bdo><ul id='ZrDDu'></ul>
    1. <small id='ZrDDu'></small><noframes id='ZrDDu'>

        yii2:在一行中连接多个值的下拉列表

        yii2:drop-down list for multiple values concat in one line(yii2:在一行中连接多个值的下拉列表)

        <small id='X8PE9'></small><noframes id='X8PE9'>

            <tbody id='X8PE9'></tbody>

            <i id='X8PE9'><tr id='X8PE9'><dt id='X8PE9'><q id='X8PE9'><span id='X8PE9'><b id='X8PE9'><form id='X8PE9'><ins id='X8PE9'></ins><ul id='X8PE9'></ul><sub id='X8PE9'></sub></form><legend id='X8PE9'></legend><bdo id='X8PE9'><pre id='X8PE9'><center id='X8PE9'></center></pre></bdo></b><th id='X8PE9'></th></span></q></dt></tr></i><div id='X8PE9'><tfoot id='X8PE9'></tfoot><dl id='X8PE9'><fieldset id='X8PE9'></fieldset></dl></div>
            <legend id='X8PE9'><style id='X8PE9'><dir id='X8PE9'><q id='X8PE9'></q></dir></style></legend>

            <tfoot id='X8PE9'></tfoot>

              <bdo id='X8PE9'></bdo><ul id='X8PE9'></ul>
                • 本文介绍了yii2:在一行中连接多个值的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  对于我的下拉列表,我正在使用此代码.

                  for my drop-down list I am using this code.

                  <?= $form->field($medicinerequest, '[' . $id . ']' . 'medicine_name')
                  ->DropDownList(ArrayHelper::map(appmodelsMedicine::find()
                  ->asArray()->all(), 'id', 'medicine_name','medicine_id' ),
                  [ 'prompt' => 'Please Select' ])?> 
                  

                  我正在获取如图所示的下拉列表.但我希望它在一行中由连字符 (-) 连接起来.我该怎么做?

                  I am getting the drop-down list as in the picture. But I want it to be concatenated by hyphen(-) in one line. How can I do this?

                  推荐答案

                  ArrayHelper::map($array, $from, $to, $group) 使用 ArrayHelper::getValue() 获取$from$to$group.ArrayHelper::getValue() 允许你传递闭包.

                  ArrayHelper::map($array, $from, $to, $group) uses ArrayHelper::getValue() to obtain the values of $from, $to and $group. ArrayHelper::getValue() allows you to pass closures.

                  匿名函数签名应该是:function($array, $defaultValue).

                  The anonymous function signature should be: function($array, $defaultValue).

                  因此您可以将 $to 设置为

                  As such you can set $to as

                  ArrayHelper::map(
                      appmodelsMedicine::find()->asArray()->all(),
                      'id',
                      function($model) {
                          return $model['medicine_name'].'-'.$model['medicine_id'];
                      }
                  )
                  

                  这篇关于yii2:在一行中连接多个值的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is Joomla 2.5 much faster than Joomla 1.5 Querywise(Joomla 2.5 比 Joomla 1.5 Querywise 快得多吗)
                  How to share Joomla login session from one joomla website to one ASP.Net MVC website(如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站)
                  htaccess redirect root to subdirectory but allow index.php in root AND query strings to function(htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用)
                  Joomla include database functions(Joomla 包含数据库功能)
                  nl2br() not working when displaying SQL results(显示 SQL 结果时 nl2br() 不起作用)
                  Joomla 2.5 JFactory::getSession(); seems to be caching in firefox(Joomla 2.5 JFactory::getSession();似乎在 Firefox 中缓存)

                    <bdo id='3LTDy'></bdo><ul id='3LTDy'></ul>
                    <i id='3LTDy'><tr id='3LTDy'><dt id='3LTDy'><q id='3LTDy'><span id='3LTDy'><b id='3LTDy'><form id='3LTDy'><ins id='3LTDy'></ins><ul id='3LTDy'></ul><sub id='3LTDy'></sub></form><legend id='3LTDy'></legend><bdo id='3LTDy'><pre id='3LTDy'><center id='3LTDy'></center></pre></bdo></b><th id='3LTDy'></th></span></q></dt></tr></i><div id='3LTDy'><tfoot id='3LTDy'></tfoot><dl id='3LTDy'><fieldset id='3LTDy'></fieldset></dl></div>

                        • <legend id='3LTDy'><style id='3LTDy'><dir id='3LTDy'><q id='3LTDy'></q></dir></style></legend>
                        • <small id='3LTDy'></small><noframes id='3LTDy'>

                          <tfoot id='3LTDy'></tfoot>

                            <tbody id='3LTDy'></tbody>