Returns the home URL.
public static home ( boolean | string $scheme = false ) : string | ||
$scheme | boolean | string | the URI scheme to use for the returned URL: - `false` (default): returning a relative URL. - `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]]. - string: returning an absolute URL with the specified scheme (either `http`, `https` or empty string for protocol-relative URL). |
Résultat | string | home URL |
public function actionSet($lang) { if (!Yii::$app->user->isGuest) { Yii::$app->user->identity->scenario = 'language'; Yii::$app->user->identity->lang = $lang; Yii::$app->user->identity->save(); } Yii::$app->session->set('lang', $lang); $redirectUrl = Yii::$app->request->get('redirect', false); if (!$redirectUrl) { $redirectUrl = Yii::$app->request->referrer; } if (!$redirectUrl) { $redirectUrl = \yii\helpers\BaseUrl::home(true); } return $this->redirect($redirectUrl); }
<?php use yii\helpers\Html; use yii\helpers\BaseUrl; use kartik\switchinput\SwitchInput; ?> <tr > <td style > <?php echo Html::a($model->place->name, BaseUrl::home() . '/place/' . $model->place->slug); ?> </td> <td style> <?php foreach ($model->meetingPlaceChoices as $mpc) { if ($mpc->user_id == $model->meeting->owner_id) { if ($mpc->status == $mpc::STATUS_YES) { $value = 1; } else { $value = 0; } echo SwitchInput::widget(['type' => SwitchInput::CHECKBOX, 'name' => 'meeting-place-choice', 'id' => 'mpc-' . $mpc->id, 'value' => $value, 'pluginOptions' => ['size' => 'mini', 'onText' => '<i class="glyphicon glyphicon-ok"></i>', 'offText' => '<i class="glyphicon glyphicon-remove"></i>', 'onColor' => 'success', 'offColor' => 'danger']]); } } ?> </td> <td style> <?php foreach ($model->meetingPlaceChoices as $mpc) { if (count($model->meeting->participants) == 0) {
admin/race">Carreras</a></li> <li><a href="<?php echo BaseUrl::home(); ?> admin/user">Usuarios</a></li> <li><a href="<?php echo BaseUrl::home(); ?> admin/category">Categorias</a></li> </ul> <?php } else { ?> <ul> <li><a href="<?php echo BaseUrl::home(); ?> admin/user/racer">Inscribir corredor</a></li> </ul> <?php } } else { ?> <a href="<?php echo BaseUrl::home(); ?> admin/default/login">Login</a> <?php } ?> </div>
$this->head(); ?> </head> <body> <?php $this->beginBody(); ?> <div class="container" id="page"> <nav id="header" class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <a class="navbar-brand" href="<?php echo \yii\helpers\BaseUrl::home(); ?> "> E-books </a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li><a href="#">Most Viewed</a></li> <li><a href="#">Top Downloads</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> <form class="navbar-form navbar-right" role="search">