ljfphp

ljfphp

这家伙有点懒,还没写个性签名!

  • 财富值55
  • 威望值10
  • 总积分165

个人信息

  • 赞了回答

    楼上正解,andWhere($condition, $params = []),三个参数值是作为$condition的数组,不存在三个参数的写法,用方法前要看下方法的使用呢。`/**

     * Adds an additional WHERE condition to the existing one.
     * The new condition and the existing one will be joined using the `AND` operator.
     * @param string|array|ExpressionInterface $condition the new WHERE condition. Please refer to [[where()]]
     * on how to specify this parameter.
     * @param array $params the parameters (name => value) to be bound to the query.
     * @return $this the query object itself
     * @see where()
     * @see orWhere()
     */`
    
  • 1、配置文件配置一下
    2、代码里面直接发就OK,代码参考博客
    https://blog.csdn.net/qq_34193883/article/details/82895578

    我的代码和这个博客的差不多,已经成功发送邮件

  • 比如我在rules里面用到这个条件,不过没什么用。本意是在repository_key 这个值等于1的时候,才去验证其他的几个参数。

    [['repository', 'staff','svn_name'], 'required',
        'when' => function ($model) {
            if($model->repository_key == 1){
                return true;
            }else{
                return false;
            }
        },
        'on' => 'assgin',
    ],
    
  • 回复了 的回答

    dropDownList是干什么的啊?

    yii自带的activeForm组件中的下拉框

  • 最后补充:
    功能已经完成了,是$model初始值的问题,当$model初始值没问题的时候,下拉框是正常的,可以区分enabled和disabled。但是我这个问题还是不大懂,为什么我重新给它赋值就没用呢?就算初始的$model为空,那我下面的赋值也成功了,为什么就是不能正常显示,百思不得其解

  • `

    public static function listBox($name, $selection = null, $items = [], $options = [])

    参数及使用:
    1
    $name:

    设置select的name字符串,这个用来设置生成的select标签的name值

    2
    $selection:

    设置select中哪位为选中字符串或者数组,这个用来设置哪个option为选中状态,因为select只能有一个option为选中。所以如果为数组的话后面匹配的值会覆盖前面匹配的值。

    `

    目前怀疑是要用到这个
    $selection 属性吗,我用model赋值,和用options方式赋值都失败了
    1、$model->status =2; 2、4'=>['selected'=>'selected']]

  • 回复了 的回答

    你的赋值语句没有问题,可能是你的前端使用js对下拉框又做了新的操作了,你检查一下

    检查了一下,这个下拉框是直接用activeForm生成出来的,也没加特别的JS事件啊,还有可能是其他的原因吗

  • 回复了 的回答

    $helpModel::COURSE_W_C_S,['options'=>['1'=>['Selected'=>true]]]

    它这个编辑有点问题的吧,图片总是显示不出来,其实图片和之前的图片差不多,就是某个选项是select="true"的状态,但是还没有被默认选中,不知道这是为什么

  • ![_@C6QGLU5)84[[V%BFPRN2Q.png](/uploads/images/201903/12091442617.png "_@C6QGLU5)84[[V%BFPRN2Q.png")

助理 等级规则
165/200
资料完整度
10/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

0

Ta的访客

0