簡體   English   中英

在一個配置文件YII中定義頁面URL

[英]defining Page URLs in one configuration file YII

無論如何,在一個配置文件中定義頁面URL並使其更加用戶友好。 例如

/index.php/randomuser/default/index => randomuser
/index.php/randomuser/default/view => randomuserview
/index.php/useroftheday/default/index => useroftheday
/index.php/useroftheday/default/view => userofthedayview

只需在您的網址管理器中以如下配置文件進行配置-

'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName'=>false,
    'rules'=>array(
        'randomuser'=> 'randomuser/default/index',
        'randomuserview'=> 'randomuser/default/view',
        'useroftheday'=> 'useroftheday/default/index',
        'userofthedayview'=> 'useroftheday/default/view'
    )
)

您的新網址將是http://domain.com/randomuser

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM