2015-04-21 106 views
2

我有一個應用程序,其註冊表單位於前端文件夾,而登錄位於後端。yii2錨點標記從fronend到後端

然後,我有這樣的菜單...

//sends the browser to frontend/web/index.php?r=site%2Fsignup 
    $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; 

    //sends the browser to frontend/web/index.php?r=site%2Flogin 
    $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; 

我想第二個環節是鏈接backend/web/index.php?r=site/login

這裏是urlManager

​​

我不知道如何使用這個網址管理器。

+1

https://github.com/yiisoft/yii2/issues/1578 –

回答

0

你可以使用相對路徑

'url' => ['../../../frontend/web/index.php?r=site/login'] 

,這是我urlManager配置

'urlManager' => [ 
      'class' => 'yii\web\UrlManager', 
      'enablePrettyUrl' => true, 
      'showScriptName' => true, 
    ], 

這樣在我的應用程序的相對路徑正常工作

+0

this returns'http://localhost/ncddp/frontend/web/index.php?r=..%2F..%2F ..%2Ffrontend%2Fweb%2Findex.php%3Fr %3Dsite%2Flogin' – beginner

+1

請注意ost你的urlManager配置,你可以在config \ main.php或config \ main-local.php中找到它 – scaisEdge

+0

我不知道名爲'urlManagerFrontEnd'的公共屬性。我無法在Yii2 API文檔中找到它。 http://www.yiiframework.com/doc-2.0/yii-web-urlmanager.html。嘗試不使用'urlManagerFrontEnd'配置元素。 – scaisEdge