PHP scandir of an url

前端 未结 2 520
忘掉有多难
忘掉有多难 2020-12-20 09:51

How can I use scandir with an URL. Now it looks like PHP doesn\'t see the URL as an URL. Is there a way to use an URL in scandir?

相关标签:
2条回答
  • 2020-12-20 10:31

    Scandir works perfectly for local directory.

    scandir — List files and directories inside the specified path

    But you can't get list of files onto server, because in many cases urls are not directly mapping on files (e.g., location command of nginx webserver). Also webservers usually block possibility of getting list files for directories (see this settings for apache)

    0 讨论(0)
  • 2020-12-20 10:36

    This is not possible. scandir() and many other file operations only work local.

    If you want to get a list of files on a remote server then you need a script/API on the server that will return that file list.

    Just imagine what would happen if you could read all files and directories on a remote machine? Security would be realy compromised.

    0 讨论(0)
提交回复
热议问题