简体   繁体   English

使用自定义路由器时cakephp2中的会话问题

[英]session issue in cakephp2 when using custom router

Actually I need to make a custom url like www.{mydomainname}.com/username, for which i added 实际上,我需要创建一个自定义网址,如www。{mydomainname} .com / username,为此我添加了

Router::connect('/:usrname',array('controller' => 'users', 'action' => 'view_user_profile'),array('pass' => array('usrname')));

Above code solved my problem but unfortunately I lost my session on view_user_profile's view and in elements (like header and footer). 上面的代码解决了我的问题,但是不幸的是,我在view_user_profile的视图和元素(如页眉和页脚)中丢失了会话。 Most interesting part is that I am getting my session in function view_user_profile in controller. 最有趣的部分是我正在控制器中的view_user_profile函数中获取会话。 Session start working fine when change 更改时会话开始正常工作

Configure::write('debug', 0); 配置:: write('debug',0); to Configure::write('debug', 1); 配置:: write('debug',1);

Please help me out if you guys have any idea. 如果你们有任何想法,请帮助我。

I don't know what happened but when i deleted php trail "?>" from my custom helper code. 我不知道发生了什么,但是当我从自定义帮助程序代码中删除了php Trail“?>”时。 my problem solved. 我的问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM