Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要获取由 url 给出的文件夹中所有文件的名称。假设网络服务器有一个目录 www.example.com/images/ 并且该文件夹包含文件 1.png、2.png 和 3.png。我需要使用目录的 url 获取这些图像文件的名称。
您不能,但网络服务器可能允许列出目录,然后它会生成一个文本或 html 页面,列出该目录中的文件。然后,您可以解析该响应。
通过在浏览器中访问 url 来测试网络服务器是否允许列出目录:www.example.com/images/并查看您得到的响应。它是某种文件列表,然后您可以解析该响应。
www.example.com/images/