PHP 可恢复错误 – yii\base\ErrorException class yii\web\Response 的对象无法转换为字符串
PHP Recoverable Error – yii\base\ErrorException Object of class yii\web\Response could not be converted to string
我使用 renderPartial 在 frontend/index.php 中查看 CRUD。但它给出错误
PHP Recoverable Error – yii\base\ErrorException
Object of class yii\web\Response could not be converted to string
这里是代码 C:\xampp\htdocs\yii2-my-app\frontend\views\site\index.php
<?= Yii::$app->runAction('/callback/create'); ?>
C:\xampp\htdocs\yii2-my-app\frontend\controllers\CallbackController.php
public function actionCreate()
{
$model = new Callback();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->renderPartial('create', [
'model' => $model,
]);
}
}
如何修复该错误有人可以帮忙吗?
public function actionCreate()
{
$model = new Callback();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model = new Callback();
return $this->renderPartial('create', [
'model' => $model,
]);}
}
我使用 renderPartial 在 frontend/index.php 中查看 CRUD。但它给出错误
PHP Recoverable Error – yii\base\ErrorException
Object of class yii\web\Response could not be converted to string
这里是代码 C:\xampp\htdocs\yii2-my-app\frontend\views\site\index.php
<?= Yii::$app->runAction('/callback/create'); ?>
C:\xampp\htdocs\yii2-my-app\frontend\controllers\CallbackController.php
public function actionCreate()
{
$model = new Callback();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->renderPartial('create', [
'model' => $model,
]);
}
}
如何修复该错误有人可以帮忙吗?
public function actionCreate()
{
$model = new Callback();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model = new Callback();
return $this->renderPartial('create', [
'model' => $model,
]);}
}