【发布时间】:2018-01-10 05:42:13
【问题描述】:
运行代码时:
return $this->render('update', [
'model' => $model,
'stok' => $stok
]);
我收到与未定义变量相关的错误:
PHP 通知 'yii\base\ErrorException' 和消息 'Undefined variable: 斯托克'
我的表格如下:
<div class="col-sm-2">
<?= $form->field($stok, 'harga_jual1')->textInput(['id' => 'hargaRetail'])->label('Harga Retail') ?>
</div>
我该如何解决这个错误?
【问题讨论】:
-
你错过了
_form.php呈现的 update.php。在此处添加'stok' => $stok。