The render() method takes a long time to execute Yii2

I just get a form with several fields. if in the controller method before return $this->render() I do echo 'Success!';exit;, then the page loads quickly. and when $this->render() is called, the page takes 10 seconds to load. I checked everything and still can't find the reason

Method in controller

public function actionIndex()
    {
        return $this->render('index');
    }

index.php

<?php
echo "index";
?>

layout.php

<?php

/* @var $this \yii\web\View */

/* @var $content string */

use backend\assets\AppAsset;
use common\models\User;
use yii\helpers\Html;

AppAsset::register($this);
/** @var User $user */
$user = Yii::$app->user->identity;
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<!-- end::Head -->
<body>
<?php $this->beginBody() ?>
    <?=$content?>
    <?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

Upvotes: 1

Views: 24

Answers (0)

Related Questions