Rails/Sinatra 中的 iphone 重定向

发布于 2024-12-29 22:01:01 字数 301 浏览 2 评论 0原文

我正在开发一个 rails + sinatra 移动应用程序,我想在其中重定向到我的服务器上的特定位置(页面)。我在 .rb 文件中调用特定的 sinatra 函数(在控制器中,位于 {app_root}/lib/ 文件夹中),该函数在执行某些功能后呈现特定视图。

这工作正常,但当我想从控制器重定向其他网站(例如 www.google.com)时,它会给出错误:加载页面错误

我正在使用 重定向“http://www.google.com”

I am working on a rails + sinatra mobile application in which I want to redirect to a specific location(page) on my server. I call a particular sinatra function (in controller which is in {app_root}/lib/ folder) in .rb file, which after performing some functionality render a specific view.

This works fine but when I want to redirect some other site like www.google.com from the controller, it gives me Error: Loading Page error.

I am using
redirect "http://www.google.com"

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

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

发布评论

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

评论(1

多像笑话 2025-01-05 22:01:01

如果您使用的是 Rails,则要使用的命令是

redirect_to "http://google.com"

http://api.rubyonrails。 org/classes/ActionController/Base.html

If you are using rails, the command you want to use is

redirect_to "http://google.com"

http://api.rubyonrails.org/classes/ActionController/Base.html

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