문제

Is there any difference in performance / reliability / ... between ftp_chdir($ftpConnection, '..') and ftp_cdup($ftpConnection)? I'm building small PHP FTP library and I'm trying to figure out if I should include both of these as functions or if chdir is enough.

도움이 되었습니까?

해결책

I don't know much about how ftp works.

But if you check the source of the ftp functions, then you see there is no arguments passed, only a command called "CDUP", this command sent to ftp.

If you use 'chdir' PHP sends a command called "CWD" with an argument (the new directory).

Probably CDUP is faster, but no real perfomance change probably.

Source: https://github.com/php/php-src/blob/af6c11c5f060870d052a2b765dc634d9e47d0f18/ext/ftp/ftp.c

Line 490 - 536

If you want my opinion, i would go with CDUP.

Good luck.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top