[英]$this->request->referer() not working properly (Cakephp 2)
There may be a lot of question regarding this but no help from these all . 关于这一点可能有很多问题,但这些都没有帮助。 .
。 I have the same issue as On this link .
我有与此链接相同的问题。
I am requesting from url http://example.com/projects/phase/test_phase2#5591409f-ce8c-4a8a-a92d-77360a11ef94 to save the progress and this is requesting on the url http://example.com/phases/update_progress . 我从网址http://example.com/projects/phase/test_phase2#5591409f-ce8c-4a8a-a92d-77360a11ef94请求保存进度,这是在网址上请求http://example.com/phases/update_progress 。 now i want to redirect my page on back to the url .
现在我想将我的页面重定向回到网址。 I am using these all .
我正在使用这些。 But no luck .
但没有运气。
$this->redirect($this->referer('/'));
$this->redirect($this->referer());
$this->redirect($this->request->referer());
$this->redirect( Router::url( $this->referer(), true ) );
after this it is redirecting to http://example.com/phases/example.com But i want it to be redirect on http://example.com/projects/phase/test_phase2#5591409f-ce8c-4a8a-a92d-77360a11ef94 . 在此之后,它将重定向到http://example.com/phases/example.com但我希望它可以重定向到http://example.com/projects/phase/test_phase2#5591409f-ce8c-4a8a-a92d-77360a11ef94 。
routes.php is routes.php是
Router::parseExtensions('json');
Router::connect('/', array('controller' => 'dashboard', 'action' => 'index'));
Router::connect('/admin', array('controller' => 'dashboard', 'action' => 'index', 'admin' => true));
Router::connect('/login', array('controller' => 'users', 'action' => 'login'));
Router::connect('/admin/login', array('controller' => 'users', 'action' => 'login', 'admin' => true));
Router::connect('/contents/*', array('controller' => 'contents', 'action' => 'view'));
.htaccess is .htaccess是
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
it is working very well on localhost . 它在localhost上运行得很好。 All files are same on both server.
两台服务器上的所有文件都相同。
Is there any other method to do this ?? 还有其他方法吗?
I tried to solve this issue by creating a HistoryComponent that saves the requests in the user's session (including the get parameters). 我试图通过创建一个在用户会话中保存请求的HistoryComponent来解决这个问题(包括get参数)。 The obvious disadvantage of this approach is that it relies on sessions.
这种方法的明显缺点是它依赖于会话。 Since the session is the same in all tabs the back buttons might influence each other in a multi-tab environment.
由于会话在所有选项卡中都相同,因此后退按钮可能会在多选项卡环境中相互影响。
If you want to use it: 如果你想使用它:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.