本文整理汇总了PHP中yii\helpers\BaseUrl::to方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseUrl::to方法的具体用法?PHP BaseUrl::to怎么用?PHP BaseUrl::to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\BaseUrl
的用法示例。
在下文中一共展示了BaseUrl::to方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/**
* Created by PhpStorm.
* User: RomanS
* Date: 14.07.2015
* Time: 16:19
*/
use yii\helpers\BaseUrl;
?>
<div class="menu">
<a class="button" href="<?php
echo BaseUrl::to(['contacts/index']);
?>
">Manager</a>
<a class="button" href="<?php
echo BaseUrl::to(['contacts/events']);
?>
">Events</a>
<a class="button" href="<?php
echo BaseUrl::to(['users/logout']);
?>
">Logout</a>
</div>
示例2:
<?php
$menuItems = [['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'Contact', 'url' => ['/site/contact']], ['label' => 'Blog', 'url' => ['/blog/index']], ['label' => 'Post', 'url' => ['/post']], ['label' => 'Product', 'url' => ['/demo/products']]];
?>
<ul class="nav">
<li><?php
echo Html::a('<span class="icon icon-exit-to-app"></span> สถานที่ท่องเที่ยว', '#');
?>
</li>
<li><?php
echo Html::a('<span class="icon icon-exit-to-app"></span> วัฒนธรรม-ประเพณี', '#');
?>
</li>
<li><?php
echo Html::a('<span class="icon icon-exit"></span> Blog', BaseUrl::to(['blog/index']));
?>
</li>
</ul>
<?php
if (!Yii::$app->user->isGuest) {
?>
<hr>
<ul class="nav">
<li>
<a href="ui-button.html">Buttons</a>
</li>
<li>
<a href="#"><span class="icon icon-exit-to-app"></span> เมนู</a>
<span class="menu-collapse-toggle collapsed" data-target="#form-elements" data-toggle="collapse"><i class="icon icon-close menu-collapse-toggle-close"></i><i class="icon icon-add menu-collapse-toggle-default"></i></span>
<ul class="menu-collapse collapse" id="form-elements">
示例3:
<a href="<?php
echo BaseUrl::to(['contacts/edit', 'id' => $contact['idContact']]);
?>
">
<button class="view">view</button>
</a>
<a class="editLink" href="<?php
echo BaseUrl::to(['contacts/edit', 'id' => $contact['idContact']]);
?>
">
<button class="edit">edit</button>
</a>
</td>
<td class="lastCol" >
<?php
$href = BaseUrl::to(['contacts/delete', 'id' => $contact['idContact']]);
$hrefPage = BaseUrl::current(['page' => $page, 'orderBy' => $orderBy, 'dir' => $dirOpposite, 'sortChange' => $sortChange]);
$onclickDelete = "name='" . $contact['lastName'] . ' ' . $contact['firstName'] . "' " . "href='" . $href . "'" . "hrefPage='" . $hrefPage . "'" . "row='" . $i . "'";
?>
<button class="delete" <?php
echo $onclickDelete;
?>
>X</button>
</td>
</tr>
<?php
$num++;
}
?>
<tr class="lastRow">
<td class="bottomLeft number"></td>