當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BaseUrl::to方法代碼示例

本文整理匯總了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>
開發者ID:romasar86,項目名稱:yiilearning,代碼行數:24,代碼來源:menu.php

示例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">
開發者ID:natcha23,項目名稱:yii2demo,代碼行數:31,代碼來源:main.php

示例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>
開發者ID:romasar86,項目名稱:yiilearning,代碼行數:31,代碼來源:paginate.php


注:本文中的yii\helpers\BaseUrl::to方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。