gpt4 book ai didi

ruby-on-rails - 如何在 Rails 中打开 URL?

转载 作者:行者123 更新时间:2023-12-02 07:13:53 25 4
gpt4 key购买 nike

我正在尝试读取某个网站的 html。

尝试 @something = open("http://www.google.com/") 失败并出现以下错误:

Errno::ENOENT in testController#show

No such file or directory - http://www.google.com/

转到 http://www.google.com/,我显然看到了该网站。我做错了什么?

谢谢!

最佳答案

您需要先require 'open-uri' 才能open() 远程路径。

the docs了解更多信息。

关于ruby-on-rails - 如何在 Rails 中打开 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2954596/

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