谁一开始就是大神?

widgetcaptcha显示问题[2.0]

前端 view index.php

<?= $form->field($model, 'captcha') ?>

    <div class="captcha">
        <?= $form->widget(yii\captcha\Captcha::className(), [
                    'template' => '{input} {image}',
                    'imageOptions'=>['alt'=>'点击换图','title'=>'点击换图', 'style'=>'cursur:pointer']]) ?>

</div>

报错:

PHP Warning – yii\base\ErrorException

Illegal string offset 'class'
in  E:\phpEnv\yii2\basic\vendor\yiisoft\yii2\base\Widget.php
    public static function widget($config = [])
    {
        ob_start();
        ob_implicit_flush(false);
        /* @var $widget Widget */
        $config['class'] = get_called_class();
        $widget = Yii::createObject($config);
        $out = $widget->run();
 
        return ob_get_clean() . $out;
    }

请教下,这是什么原因导致的?谢谢

$form->field($model, 'captcha')->widget(yii\captcha\Captcha::className(), [])

赞(0) 打赏
未经允许不得转载:菜鸟之家 » widgetcaptcha显示问题[2.0]

评论 抢沙发

登录

找回密码

注册