本文整理汇总了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>';
}