How do I handle FTP functions in PHP?

When connecting to mysql, I have functions for receiving the corresponding error message and error code, I do not see anything in the sorting in the list of PHP ftp-functions.
Is there a best practice for handling FTP errors?

EDIT + CLARIFICATION: I think the best error messages are system error messages + my own, is there any way to catch system error messages?

+3
source share
3 answers

Try error_get_last()for PHP> = 5.2 or $php_errmsgfor older versions as described on related pages

+6
source

, ftp . .

, .

0

You can check the values ​​returned by functions. Usually it returns something like true (success) and false (fail). Take for example ftp_fget. php.net says:

Returns TRUE on success or FALSE failure.

0
source

Source: https://habr.com/ru/post/1745276/


All Articles