zend framework 实现博客效果的 URL
假设网站域名为 http://www.hello.com
更改 .htaccess指向的index.php
../public/index.php部分代码如下
$ctrl = Zend_Controller_Front::getInstance();$router = $ctrl->getRouter();//:username 是变量 ,也就是YourName,module->指向的模块名称,controller->指向的控制器,action->指向的动作
$route = new Zend_Controller_Router_Route ( ':username', array ('module'=>'rout','controller' => 'index', 'action' => 'info' ) );
$router->addRoute ( 'user', $route );rout 模块下 IndexController.php 部分代码public function infoAction() { $username = $this->_getParam('username'); print_r($username); exit ();}