开发者

url routing in zend framework

开发者 https://www.devze.com 2023-01-18 06:23 出处:网络
Hi I created several module for my own CMS like category, article, core , ... now how can I access these modules with url like:

Hi I created several module for my own CMS like category, article, core , ...

now how can I access these modules with url like:

http://local开发者_高级运维host/mycms/admin/category

http://localhost/mycms/admin/article , ...

note: the admin is not module, it's only prefix


In "application/Bootstrap.php":

public function _initRoute(){    

$frontController = Zend_Controller_Front::getInstance();

            $router = $frontController->getRouter(); // returns a rewrite router by default
            $router->addRoute(
                'category',
                new Zend_Controller_Router_Route('admin/category/:controller/:action',
                                                 array('module' => 'category',
                                                        'controller' => 'index',
                                                       'action' => 'index'))
            );
}

Then type in URL : ex : http://localhost/mycms/admin/category and you get there.

Same with others.

0

精彩评论

暂无评论...
验证码 换一张
取 消