首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

zend framework怎么实现像 微博一样的 action

2012-03-23 
zend framework如何实现像 微博一样的 action?zend framework如何实现像 微博一样的 action?比如腾讯微博

zend framework如何实现像 微博一样的 action?
zend framework如何实现像 微博一样的 action?

比如腾讯微博的 t.qq.com/ yourname 

这个 yourname 是存放在数据库用户表中的 username一列。 那么zend framework如何实现这个功能呢。

像其它静态的action都是可以直接写好 controllers.但是动态的我就不懂了。

我是个初学者,很多不懂。知者望能详细指点。。用纯粹的php也行,但别用别的框架,我研究zf蛋都碎了。不想再又去搞另一个框架。

谢谢。。

[解决办法]
zend有router,看这里即可

http://framework.zend.com/manual/1.11/en/zend.controller.router.html
[解决办法]

../public/index.php部分代码如下 

$ctrl = Zend_Controller_Front::getInstance();
$router = $ctrl->getRouter();
//:username 是变量 ,module->设置模块
$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 ();
}

呵呵 结贴吧,这样就可以实现了,楼主还有什么问题 可以随时沟通 呵呵

热点排行