ftp.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,959 行 · 第 1/5 页
PHP
1,959 行
<?php/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: *//** * Net_FTP main file. * * This file must be included to use the Net_FTP package. * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Networking * @package FTP * @author Tobias Schlitt <toby@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: FTP.php,v 1.42 2005/03/31 20:07:58 toby Exp $ * @link http://pear.php.net/package/Net_FTP * @since File available since Release 0.0.1 */require_once 'PEAR.php';/** * Option to let the ls() method return only files. * * @since 1.3 * @name NET_FTP_FILES_ONLY * @see Net_FTP::ls() */define('NET_FTP_FILES_ONLY', 0, true);/** * Option to let the ls() method return only directories. * * @since 1.3 * @name NET_FTP_DIRS_ONLY * @see Net_FTP::ls() */define('NET_FTP_DIRS_ONLY', 1, true);/** * Option to let the ls() method return directories and files (default). * * @since 1.3 * @name NET_FTP_DIRS_FILES * @see Net_FTP::ls() */define('NET_FTP_DIRS_FILES', 2, true);/** * Option to let the ls() method return the raw directory listing from ftp_rawlist(). * * @since 1.3 * @name NET_FTP_RAWLIST * @see Net_FTP::ls() */define('NET_FTP_RAWLIST', 3, true);/** * Error code to indicate a failed connection * This error code indicates, that the connection you tryed to set up * could not be established. Check your connection settings (host & port)! * * @since 1.3 * @name NET_FTP_ERR_CONNECT_FAILED * @see Net_FTP::connect() */define('NET_FTP_ERR_CONNECT_FAILED', -1);/** * Error code to indicate a failed login * This error code indicates, that the login to the FTP server failed. Check * your user data (username & password). * * @since 1.3 * @name NET_FTP_ERR_LOGIN_FAILED * @see Net_FTP::login() */define('NET_FTP_ERR_LOGIN_FAILED', -2);/** * Error code to indicate a failed directory change * The cd() method failed. Ensure that the directory you wanted to access exists. * * @since 1.3 * @name NET_FTP_ERR_DIRCHANGE_FAILED * @see Net_FTP::cd() */define('NET_FTP_ERR_DIRCHANGE_FAILED', 2); // Compatibillity reasons!/** * Error code to indicate that Net_FTP could not determine the current path * The cwd() method failed and could not determine the path you currently reside * in on the FTP server. * * @since 1.3 * @name NET_FTP_ERR_DETERMINEPATH_FAILED * @see Net_FTP::pwd() */define('NET_FTP_ERR_DETERMINEPATH_FAILED', 4); // Compatibillity reasons!/** * Error code to indicate that the creation of a directory failed * The directory you tryed to create could not be created. Check the * access rights on the parent directory! * * @since 1.3 * @name NET_FTP_ERR_CREATEDIR_FAILED * @see Net_FTP::mkdir() */define('NET_FTP_ERR_CREATEDIR_FAILED', -4);/** * Error code to indicate that the EXEC execution failed. * The execution of a command using EXEC failed. Ensure, that your * FTP server supports the EXEC command. * * @since 1.3 * @name NET_FTP_ERR_EXEC_FAILED * @see Net_FTP::execute() */define('NET_FTP_ERR_EXEC_FAILED', -5);/** * Error code to indicate that the SITE command failed. * The execution of a command using SITE failed. Ensure, that your * FTP server supports the SITE command. * * @since 1.3 * @name NET_FTP_ERR_SITE_FAILED * @see Net_FTP::site() */define('NET_FTP_ERR_SITE_FAILED', -6);/** * Error code to indicate that the CHMOD command failed. * The execution of CHMOD failed. Ensure, that your * FTP server supports the CHMOD command and that you have the appropriate * access rights to use CHMOD. * * @since 1.3 * @name NET_FTP_ERR_CHMOD_FAILED * @see Net_FTP::chmod() */define('NET_FTP_ERR_CHMOD_FAILED', -7);/** * Error code to indicate that a file rename failed * The renaming of a file on the server failed. Ensure that you have the * appropriate access rights to rename the file. * * @since 1.3 * @name NET_FTP_ERR_RENAME_FAILED * @see Net_FTP::rename() */define('NET_FTP_ERR_RENAME_FAILED', -8);/** * Error code to indicate that the MDTM command failed * The MDTM command is not supported for directories. Ensure that you gave * a file path to the mdtm() method, not a directory path. * * @since 1.3 * @name NET_FTP_ERR_MDTMDIR_UNSUPPORTED * @see Net_FTP::mdtm() */define('NET_FTP_ERR_MDTMDIR_UNSUPPORTED', -9);/** * Error code to indicate that the MDTM command failed * The MDTM command failed. Ensure that your server supports the MDTM command. * * @since 1.3 * @name NET_FTP_ERR_MDTM_FAILED * @see Net_FTP::mdtm() */define('NET_FTP_ERR_MDTM_FAILED', -10);/** * Error code to indicate that a date returned by the server was misformated * A date string returned by your server seems to be missformated and could not be * parsed. Check that the server is configured correctly. If you're sure, please * send an email to the auhtor with a dumped output of $ftp->ls('./', NET_FTP_RAWLIST); * to get the date format supported. * * @since 1.3 * @name NET_FTP_ERR_DATEFORMAT_FAILED * @see Net_FTP::mdtm(), Net_FTP::ls() */define('NET_FTP_ERR_DATEFORMAT_FAILED', -11);/** * Error code to indicate that the SIZE command failed * The determination of the filesize of a file failed. Ensure that your server supports the * SIZE command. * * @since 1.3 * @name NET_FTP_ERR_SIZE_FAILED * @see Net_FTP::size() */define('NET_FTP_ERR_SIZE_FAILED', -12);/** * Error code to indicate that a local file could not be overwritten * You specified not to overwrite files. Therefore the local file has not been * overwriten. If you want to get the file overwriten, please set the option to * do so. * * @since 1.3 * @name NET_FTP_ERR_OVERWRITELOCALFILE_FORBIDDEN * @see Net_FTP::get(), Net_FTP::getRecursive() */define('NET_FTP_ERR_OVERWRITELOCALFILE_FORBIDDEN', -13);/** * Error code to indicate that a local file could not be overwritten * Also you specified to overwrite the local file you want to download to, * it has not been possible to do so. Check that you have the appropriate access * rights on the local file to overwrite it. * * @since 1.3 * @name NET_FTP_ERR_OVERWRITELOCALFILE_FAILED * @see Net_FTP::get(), Net_FTP::getRecursive() */define('NET_FTP_ERR_OVERWRITELOCALFILE_FAILED', -14);/** * Error code to indicate that the file you wanted to upload does not exist * The file you tried to upload does not exist. Ensure that it exists. * * @since 1.3 * @name NET_FTP_ERR_LOCALFILENOTEXIST * @see Net_FTP::put(), Net_FTP::putRecursive() */define('NET_FTP_ERR_LOCALFILENOTEXIST', -15);/** * Error code to indicate that a remote file could not be overwritten * You specified not to overwrite files. Therefore the remote file has not been * overwriten. If you want to get the file overwriten, please set the option to * do so. * * @since 1.3 * @name NET_FTP_ERR_OVERWRITEREMOTEFILE_FORBIDDEN * @see Net_FTP::put(), Net_FTP::putRecursive() */define('NET_FTP_ERR_OVERWRITEREMOTEFILE_FORBIDDEN', -16);/** * Error code to indicate that the upload of a file failed * The upload you tried failed. Ensure that you have appropriate access rights * to upload the desired file. * * @since 1.3 * @name NET_FTP_ERR_UPLOADFILE_FAILED * @see Net_FTP::put(), Net_FTP::putRecursive() */define('NET_FTP_ERR_UPLOADFILE_FAILED', -17);/** * Error code to indicate that you specified an incorrect directory path * The remote path you specified seems not to be a directory. Ensure that * the path you specify is a directory and that the path string ends with * a /. * * @since 1.3 * @name NET_FTP_ERR_REMOTEPATHNODIR * @see Net_FTP::putRecursive(), Net_FTP::getRecursive() */define('NET_FTP_ERR_REMOTEPATHNODIR', -18);/** * Error code to indicate that you specified an incorrect directory path * The local path you specified seems not to be a directory. Ensure that * the path you specify is a directory and that the path string ends with * a /. * * @since 1.3 * @name NET_FTP_ERR_LOCALPATHNODIR * @see Net_FTP::putRecursive(), Net_FTP::getRecursive() */define('NET_FTP_ERR_LOCALPATHNODIR', -19);/** * Error code to indicate that a local directory failed to be created * You tried to create a local directory through getRecursive() method, * which has failed. Ensure that you have the appropriate access rights * to create it. * * @since 1.3 * @name NET_FTP_ERR_CREATELOCALDIR_FAILED * @see Net_FTP::getRecursive() */define('NET_FTP_ERR_CREATELOCALDIR_FAILED', -20);/** * Error code to indicate that the provided hostname was incorrect * The hostname you provided was invalid. Ensure to provide either a * full qualified domain name or an IP address. * * @since 1.3 * @name NET_FTP_ERR_HOSTNAMENOSTRING * @see Net_FTP::setHostname() */define('NET_FTP_ERR_HOSTNAMENOSTRING', -21);/** * Error code to indicate that the provided port was incorrect * The port number you provided was invalid. Ensure to provide either a * a numeric port number greater zero. * * @since 1.3 * @name NET_FTP_ERR_PORTLESSZERO * @see Net_FTP::setPort() */define('NET_FTP_ERR_PORTLESSZERO', -22);/** * Error code to indicate that you provided an invalid mode constant * The mode constant you provided was invalid. You may only provide * FTP_ASCII or FTP_BINARY. * * @since 1.3 * @name NET_FTP_ERR_NOMODECONST * @see Net_FTP::setMode() */define('NET_FTP_ERR_NOMODECONST', -23);/** * Error code to indicate that you provided an invalid timeout * The timeout you provided was invalid. You have to provide a timeout greater * or equal to zero. * * @since 1.3 * @name NET_FTP_ERR_TIMEOUTLESSZERO * @see Net_FTP::Net_FTP(), Net_FTP::setTimeout() */define('NET_FTP_ERR_TIMEOUTLESSZERO', -24);/** * Error code to indicate that you provided an invalid timeout * An error occured while setting the timeout. Ensure that you provide a * valid integer for the timeount and that your PHP installation works * correctly. * * @since 1.3 * @name NET_FTP_ERR_SETTIMEOUT_FAILED * @see Net_FTP::Net_FTP(), Net_FTP::setTimeout() */define('NET_FTP_ERR_SETTIMEOUT_FAILED', -25);/** * Error code to indicate that the provided extension file doesn't exist * The provided extension file does not exist. Ensure to provided an * existant extension file. * * @since 1.3 * @name NET_FTP_ERR_EXTFILENOTEXIST * @see Net_FTP::getExtensionFile() */define('NET_FTP_ERR_EXTFILENOTEXIST', -26);/** * Error code to indicate that the provided extension file is not readable * The provided extension file is not readable. Ensure to have sufficient * access rights for it. * * @since 1.3 * @name NET_FTP_ERR_EXTFILEREAD_FAILED * @see Net_FTP::getExtensionFile() */define('NET_FTP_ERR_EXTFILEREAD_FAILED', -27);/** * Error code to indicate that the deletion of a file failed * The specified file could not be deleted. Ensure to have sufficient * access rights to delete the file. * * @since 1.3 * @name NET_FTP_ERR_EXTFILEREAD_FAILED * @see Net_FTP::rm() */define('NET_FTP_ERR_DELETEFILE_FAILED', -28);/**
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?