gpt4 book ai didi

CakePHP 重定向到外部 URL

转载 作者:行者123 更新时间:2023-12-03 13:43:29 24 4
gpt4 key购买 nike

在 CakePHP 中,我想创建一个从我的站点指向另一个站点的自定义 URL。

示例:example.com/google 将重定向到 http://www.google.com

我是一个自学的 CakePHP 新手,只是无法弄清楚步骤。从我的作业来看,我想我可以在 config/routes.php 中创建一个到 Controller / Action 的路由,但是我没有正确的术语来在 Controller 中创建 Action 。

最佳答案

如果您想直接将表单 Controller 重定向到外部 url,我们可以直接使用

$this->redirect('http://www.google.com');

从我们的 Controller 。它会将您重定向到上述地址。这工作得很好。

关于CakePHP 重定向到外部 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8332166/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com