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

WBOY
Libérer: 2016-06-13 13:43:55
original
734 Les gens l'ont consulté

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 ();
}

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

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!