我正在使用 Rails 控制器。我调用一个wget命令system(wget ...),我想要一个指示下载文件的文件名的变量。
例如,对于wget google.com、 或wget www.google.com、 或wget www.google.com/、 或wget http://www.google.com,返回的名称应该是index.html。
对于example.com/firstpage.html,返回名称应该是firstpage.html。
如您所见,我不能简单地在最后一个反斜杠后去掉名称。我该怎么做?