简体   繁体   English

PHP ftp_nlist提供不同的字符串

[英]PHP ftp_nlist give different strings

I've got a class, which should delete a folder on an FTP-Server. 我有一个课程,应该删除FTP服务器上的文件夹。 The connection works well, deleting of a specific file also works. 连接效果很好,删除特定文件也可以。 Now, I want to delete the files in a loop. 现在,我想循环删除文件。 My problem is: On one FTP-Server, the files (fetched by nlist) looks like this: 我的问题是:在一个FTP服务器上,文件(由nlist提取)如下所示:

array:3 [
  0 => "/var/www/clxpreview.ch/public_html/test-dgis/index.html"
  1 => "/var/www/clxpreview.ch/public_html/test-dgis/."
  2 => "/var/www/clxpreview.ch/public_html/test-dgis/.."
]

On the other (new installed) FTP-Server, it just looks like this: 在另一台(新安装的)FTP服务器上,它看起来像这样:

array:3 [
  0 => "drwxr-xr-x    2 1001     1001         4096 Nov 11 11:53 ."
  1 => "drwxr-xr-x    4 1001     33           4096 Nov 11 11:51 .."
  2 => "-rw-r--r--    1 1001     1001         3231 Nov 11 11:51 index.html"
]

Same PHP-Code, same files, just an other server. 相同的PHP代码,相同的文件,只是另一个服务器。

How can I configure the server, that it looks like the same on both servers? 如何配置服务器,使两台服务器看起来都一样?

I've got the solution. 我有解决方案。 I've been using $subItems = $this->nlist('-ls ' . $path); 我一直在使用$subItems = $this->nlist('-ls ' . $path); to fetch all items, but this returned the different results. 来获取所有项目,但这返回了不同的结果。 Now, I'm using $subItems = $this->nlist($path); 现在,我正在使用$subItems = $this->nlist($path); and this is returning only the full path of the files, exactly what I want. 而这仅返回文件的完整路径,正是我想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM