通过 $_GET 将参数传递给 ->redirect()

发布于 2024-12-03 19:28:34 字数 558 浏览 0 评论 0原文

您好,我有这句话

$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity');

Is it possible to call the "redirect" method and pass参数 via $_GET ?那么在“newactivity”页面中我可以要求 $_GET['something'] 吗?

像这样的东西

$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity?id=1'); (this doesn't work)

or

   $g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity','id=1');

谢谢

Hi I have this sentence

$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity');

Is it possible to call the "redirect" method and passing parameters via $_GET ? so in the page "newactivity" I can ask for $_GET['something'] ?

Something like this

$g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity?id=1'); (this doesn't work)

or

   $g->addButton('')->set('NEW ACTIVITY')->js('click')->univ()->redirect('newactivity','id=1');

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

糖果控 2024-12-10 19:28:34

您需要的是正确构建目标 URL。

http://agiletoolkit.org/learn/understand/page/link

->univ()->redirect($this->api->getDestinationURL('newactivity',array('id'=>1)));

使用stickyGET会影响您将在此时生成的所有网址。因此,如果添加 2 个链接,每个链接都会传递 ID。

如果您需要传递已经通过 GET 传递的参数,那么 StickyGET 会更好,例如

array('id'=>$_GET['id']);

What you need is to properly build destination URL.

http://agiletoolkit.org/learn/understand/page/link

->univ()->redirect($this->api->getDestinationURL('newactivity',array('id'=>1)));

using stickyGET will affect ALL the urls you are going to produce form this point on. So if you add 2 links, each of them would be passing ID.

stickyGET is better if you need to pass argument which was already passed through GET, such as

array('id'=>$_GET['id']);
淡紫姑娘! 2024-12-10 19:28:34

这里也是其他 ATK4 开发者聊天的地方,也许是您 ATK4 Q 的另一个资源。 https://chat.stackoverflow.com/rooms/2966/agile-toolkit-atk4

Here is a place where other ATK4 Developers chat too, perhaps another resource for your ATK4 Q's. https://chat.stackoverflow.com/rooms/2966/agile-toolkit-atk4

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文