简体   繁体   中英

Yii2 backend bootstrap treeview url is not working properly

I integrated AdminLTE with Yii2 framework, created the model and generated the CRUD models without any issues. But when I try the treeview URL to access the page, it's showing a page not found error and I don't know how to fix this issue.

Could you please tell me what's wrong with my code ?

<ul class="sidebar-menu" data-widget="tree">
    <li class="header">MAIN NAVIGATION</li>
    <li>
        <a href="index.php">
            <i class="fa fa-dashboard"/>
            <span>Dashboard</span>
        </a>
    </li>

    <li class="treeview">
        <a href="#">
           <i class="fa fa-user"></i>
           <span>User</span>
        </a>
        <ul class="treeview-menu">
            <li>
                <a href="index.php?r=users/create">
                    <i class="fa fa-user-circle"/>Create User
                </a>
            </li>
            <li>
                <a href="index.php?r=users">
                    <i class="fa fa fa-eye"/>View User
                </a>
            </li>
        </ul>
    </li>
</ul>

And I attached the Image error message screenshots.

Could it be a singular/plural problem in your link? Is your controller class named UserController or User s Controller ?

If you're following the Yii schema design guidelines , your users model / controller should be named User . So your link should be <a href="index.php?r=user/create"> and <a href="index.php?r=user">

You should also consider to write your links using Yii's helpers Url::to that take care of every aspect of your application's configuration:

<?= Url::to(['user/index']) ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM