cakephp 2重定向网址与主题标签 [英] cakephp 2 redirect url with hashtag

查看:196
本文介绍了cakephp 2重定向网址与主题标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用cakephp的重定向控制器函数重定向包含hashtag(#)的url。

I'm trying to redirect an url containing a hashtag(#) with cakephp's redirect controller function.

当我使用此代码时,网址会对主题标签进行编码。

When I use this code it url encodes the hashtag

$this->redirect(array('action' => 'index',$menuItem."#article_id_".$created_id));

output: http://something.com/link%23article_id_62

是否有一种方法

推荐答案

您需要使用

$this->redirect([
    // ...
    '#' => 'article_id_' . $created_id,
]);

这篇关于cakephp 2重定向网址与主题标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆