前端 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(), [])