本文整理匯總了PHP中helpers\Url::to方法的典型用法代碼示例。如果您正苦於以下問題:PHP Url::to方法的具體用法?PHP Url::to怎麽用?PHP Url::to使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類helpers\Url
的用法示例。
在下文中一共展示了Url::to方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<form action='?r=users/login' method="POST">
<p>
<label>Username
<input name="username" /></label>
</p>
<p>
<label>Password
<input name="password" /></label>
</p>
<p>
<input type="submit" />
</p>
</form>
<a href="<?php
echo \helpers\Url::to(['users/register']);
?>
">Register</a>
示例2: redirect
public function redirect($url)
{
$url = Url::to($url);
header('Location: ' . $url);
}
示例3:
if (\classes\F::$app->getUser()->getId()) {
?>
<a href="<?php
echo \helpers\Url::to(['users/logout']);
?>
">Logout</a>
<a href="<?php
echo \helpers\Url::to(['users/profile']);
?>
">Profile</a>
<?php
} else {
?>
<a href="<?php
echo \helpers\Url::to(['users/login']);
?>
">Login</a>
<?php
}
?>
<?php// print_r($_SESSION) ?>
</body>
<?php
echo $content;
?>
<h1>Подвал</h1>
示例4: foreach
<h1>Список Объявлений</h1>
<?php
foreach ($items as $item) {
?>
<p><?php
echo $item['title'];
?>
by <?php
echo \models\User::findUserById($item['owner'])->username;
?>
at <?php
echo date('Y:m:d', \models\User::findUserById($item['owner'])->date_created);
?>
</p>
<?php
}
?>
<a href="<?php
echo \helpers\Url::to(['items/create']);
?>
">Create new</a>
示例5: actionColumn
public static function actionColumn($model, $param)
{
return '<a href="' . Url::to(['view/' . $model->{$param}]) . '"><i class="glyphicon glyphicon-eye-open"></i></a>
<a href="' . Url::to(['update/' . $model->{$param}]) . '"><i class="glyphicon glyphicon-pencil"></i></a>
<a onclick="if (confirm(\'Are you sure want to delete this item?\') == false) return false" href="' . Url::to(['delete/' . $model->{$param}]) . '"><i class="glyphicon glyphicon-trash"></i></a>';
}