当前位置: 首页>>代码示例>>PHP>>正文


PHP ftp_get_option函数代码示例

本文整理汇总了PHP中ftp_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_get_option函数的具体用法?PHP ftp_get_option怎么用?PHP ftp_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ftp_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connect

 function connect()
 {
     if (!$this->options['hostname'] || !$this->options['username'] || !$this->options['password']) {
         if (!defined('SUPPORT_URL')) {
             define('SUPPORT_URL', getOption('supportURL'));
         }
         appUpdateMsg('<a href="' . SUPPORT_URL . 'solution/articles/195233-asking-for-ftp-sftp-details-during-update/" target="_blank">See how to add the FTP details</a>.');
         return false;
     }
     if (isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect')) {
         $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT);
     } else {
         $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT);
     }
     if (!$this->link) {
         //$this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
         appUpdateMsg(sprintf('Failed to connect to the FTP server "%1$s:%2$s"', $this->options['hostname'], $this->options['port']));
         return false;
     }
     if (!@ftp_login($this->link, $this->options['username'], $this->options['password'])) {
         //$this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
         appUpdateMsg(sprintf('FTP username or password incorrect for "%s"', $this->options['username']));
         return false;
     }
     //Set the Connection to use Passive FTP
     if ($this->options['passive']) {
         @ftp_pasv($this->link, true);
     }
     if (@ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FS_TIMEOUT) {
         @ftp_set_option($this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT);
     }
     return true;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:33,代码来源:fileSystemFTPExt.php

示例2: connect

 public function connect($host, $login, $password)
 {
     if (!parent::connect($host, $login, $password)) {
         return false;
     }
     if (empty($this->port)) {
         $this->port = 21;
     }
     $this->handle = $this->ssl && function_exists('ftp_ssl_connect') ? @ftp_ssl_connect($this->host, $this->port, $this->timeout) : @ftp_connect($this->host, $this->port, $this->timeout);
     if ($this->handle && @ftp_login($this->handle, $this->login, $this->password)) {
         @ftp_pasv($this->handle, true);
         if (@ftp_get_option($this->handle, FTP_TIMEOUT_SEC) < $this->timeout) {
             @ftp_set_option($this->handle, FTP_TIMEOUT_SEC, $this->timeout);
         }
         $this->connected = true;
         return true;
     }
     return false;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:19,代码来源:remote.ftp.class.php

示例3: connect

 public function connect()
 {
     if (isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect')) {
         $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT);
     } else {
         $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT);
     }
     if (!$this->link) {
         $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
         return false;
     }
     if (!@ftp_login($this->link, $this->options['username'], $this->options['password'])) {
         $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
         return false;
     }
     // Set the Connection to use Passive FTP
     @ftp_pasv($this->link, true);
     if (@ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FS_TIMEOUT) {
         @ftp_set_option($this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT);
     }
     return true;
 }
开发者ID:kuryerov,项目名称:portfolio,代码行数:22,代码来源:class-wp-filesystem-ftpext.php

示例4: connect

 function connect()
 {
     if (isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect')) {
         $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], $this->options['connect_timeout']);
     } else {
         $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], $this->options['connect_timeout']);
     }
     if (!$this->link) {
         $this->errors->add('connect', sprintf('Could not connect to FTP server %s:%s', $this->options['hostname'], $this->options['port']));
         return false;
     }
     if (!@ftp_login($this->link, $this->options['username'], $this->options['password'])) {
         $this->errors->add('auth', 'The username and/or password is incorrect.');
         return false;
     }
     //Set the Connection to use Passive FTP
     @ftp_pasv($this->link, true);
     if (@ftp_get_option($this->link, FTP_TIMEOUT_SEC) < $this->options['connection_timeout']) {
         @ftp_set_option($this->link, FTP_TIMEOUT_SEC, $this->options['connection_timeout']);
     }
     return true;
 }
开发者ID:pcbrsites,项目名称:leeflets,代码行数:22,代码来源:ftpext.php

示例5: getOption

 /**
  *
  * 返回当前 FTP 连接的各种不同的选项设置
  *
  * @param int $option
  * @return mixed
  */
 public static function getOption($option)
 {
     return ftp_get_option(self::$resource, $option);
 }
开发者ID:luozhanhong,项目名称:share,代码行数:11,代码来源:ftp.php

示例6: getAutoseek

 /**
  * Determine if autoseek is enabled.
  * Autoseek is used by the unobtrusive Upload/Download methods to automatically find the resume position.
  *
  * @return bool
  */
 public function getAutoseek()
 {
     if (is_resource($this->cid)) {
         return @ftp_get_option($this->cid, FTP_AUTOSEEK);
     }
 }
开发者ID:bergi9,项目名称:2Moons,代码行数:12,代码来源:ftp.class.php

示例7: evaluate


//.........这里部分代码省略.........
                     $keyLen = $encoding && $encoding !== 'ASCII' ? static::strLen($key) . '; ' . $encoding : static::strLen($key);
                     $keyInfo = "{$keyInfo}({$keyLen})";
                 } else {
                     $keyLen = strlen($key);
                 }
                 $this->fmt->startRow();
                 $this->fmt->text('key', $key, "Key: {$keyInfo}");
                 $this->fmt->colDiv($max - $keyLen);
                 $this->fmt->sep('=>');
                 $this->fmt->colDiv();
                 $this->evaluate($value, $specialStr);
                 $this->fmt->endRow();
             }
             unset($subject[static::MARKER_KEY]);
             $this->fmt->endGroup();
             return;
             // resource
         // resource
         case 'resource':
             $meta = array();
             $resType = get_resource_type($subject);
             $this->fmt->text('resource', strval($subject));
             if (!static::$config['showResourceInfo']) {
                 return $this->fmt->emptyGroup($resType);
             }
             // @see: http://php.net/manual/en/resource.php
             // need to add more...
             switch ($resType) {
                 // curl extension resource
                 case 'curl':
                     $meta = curl_getinfo($subject);
                     break;
                 case 'FTP Buffer':
                     $meta = array('time_out' => ftp_get_option($subject, FTP_TIMEOUT_SEC), 'auto_seek' => ftp_get_option($subject, FTP_AUTOSEEK));
                     break;
                     // gd image extension resource
                 // gd image extension resource
                 case 'gd':
                     $meta = array('size' => sprintf('%d x %d', imagesx($subject), imagesy($subject)), 'true_color' => imageistruecolor($subject));
                     break;
                 case 'ldap link':
                     $constants = get_defined_constants();
                     array_walk($constants, function ($value, $key) use(&$constants) {
                         if (strpos($key, 'LDAP_OPT_') !== 0) {
                             unset($constants[$key]);
                         }
                     });
                     // this seems to fail on my setup :(
                     unset($constants['LDAP_OPT_NETWORK_TIMEOUT']);
                     foreach (array_slice($constants, 3) as $key => $value) {
                         if (ldap_get_option($subject, (int) $value, $ret)) {
                             $meta[strtolower(substr($key, 9))] = $ret;
                         }
                     }
                     break;
                     // mysql connection (mysql extension is deprecated from php 5.4/5.5)
                 // mysql connection (mysql extension is deprecated from php 5.4/5.5)
                 case 'mysql link':
                 case 'mysql link persistent':
                     $dbs = array();
                     $query = @mysql_list_dbs($subject);
                     while ($row = @mysql_fetch_array($query)) {
                         $dbs[] = $row['Database'];
                     }
                     $meta = array('host' => ltrim(@mysql_get_host_info($subject), 'MySQL host info: '), 'server_version' => @mysql_get_server_info($subject), 'protocol_version' => @mysql_get_proto_info($subject), 'databases' => $dbs);
                     break;
开发者ID:jackzard,项目名称:JackFramework,代码行数:67,代码来源:ref.php

示例8: getTimeout

 /**
  * Get the currently set timeout.
  * Returns the actual timeout set.
  *
  * @access public
  * @return int The actual timeout
  */
 function getTimeout()
 {
     return ftp_get_option($this->_handle, FTP_TIMEOUT_SEC);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:11,代码来源:FTP.php

示例9: getRemoteFile

 /**
  * Lance le téléchargement du fichier par FTP sur le serveur
  * @param $directory_file
  * @param $server_file
  * @return bool
  */
 public function getRemoteFile($directory_file, $server_file)
 {
     $timeout = ftp_get_option($this->ftpConnect(), FTP_TIMEOUT_SEC);
     // try to download server_file and save to local_file
     if (ftp_get($this->ftpConnect(), $directory_file, $server_file, FTP_BINARY)) {
         return true;
     } else {
         return false;
     }
     ftp_close($this->ftpConnect());
 }
开发者ID:magix-cms,项目名称:magixcms-3,代码行数:17,代码来源:ftp.php

示例10: getOption

 /**
  * Retrieves various runtime behaviour of the current stream
  * @link http://php.net/ftp_get_option
  *
  * @param  integer $option Runtime option. (FTPWrapper::TIMEOUT_SEC, FTPWrapper::AUTOSEEK)
  * @return mixed   Value on success, FALSE on error
  */
 public function getOption($option)
 {
     return ftp_get_option($this->connection->getStream(), $option);
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:11,代码来源:FTPWrapper.php

示例11: woo_ce_cron_export


//.........这里部分代码省略.........
			// Delete the export file regardless of whether e-mail was successful or not
			wp_delete_attachment( $post_ID, true );
			error_log( sprintf( '[store-exporter-deluxe] %s: Success: %s', $export->filename, sprintf( __( 'Scheduled export e-mail of %s sent to %s', 'woo_ce' ), $export->filename, $export->to ) ) );

		}
		if( $gui == 'ftp' ) {

			// Load up our FTP/SFTP resources
			$host = woo_ce_get_option( 'auto_ftp_method_host', '' );
			if( !empty( $host ) )
				$host = woo_ce_format_ftp_host( $host );
			$port = woo_ce_get_option( 'auto_ftp_method_port', '' );
			$port = ( !empty( $port ) ? absint( $port ) : false );
			$user = woo_ce_get_option( 'auto_ftp_method_user', '' );
			$pass = woo_ce_get_option( 'auto_ftp_method_pass', '' );
			$path = woo_ce_get_option( 'auto_ftp_method_path', '' );
			$filename = woo_ce_get_option( 'auto_ftp_method_filename', '' );
			// Switch to fixed export filename if provided
			if( !empty( $filename ) )
				$export->filename = woo_ce_generate_filename( $export->type, $filename ) . '.' . $file_extension;

			// Check what protocol are we using; FTP or SFTP?
			$protocol = woo_ce_get_option( 'auto_ftp_method_protocol', 'ftp' );
			switch( $protocol ) {

				case 'ftp':
				default:
					// Check if ftp_connect() is available
					if( function_exists( 'ftp_connect' ) ) {
						$passive = woo_ce_get_option( 'auto_ftp_method_passive', '' );
						$timeout = woo_ce_get_option( 'auto_ftp_method_timeout', '' );
						if( $connection = @ftp_connect( $host, $port ) ) {
							// Update the FTP timeout if available and if a timeout was provided at export
							$remote_timeout = ftp_get_option( $connection, FTP_TIMEOUT_SEC );
							$timeout = absint( $timeout );
							if( $remote_timeout !== false && !empty( $timeout ) ) {
								// Compare the server timeout and the timeout provided at export
								if( $remote_timeout <> $timeout ) {
									if( ftp_set_option( $connection, FTP_TIMEOUT_SEC, $timeout ) == false )
										error_log( sprintf( '[store-exporter-deluxe] %s: Warning: %s', $export->filename, sprintf( __( 'Could not change the FTP server timeout on %s', 'woo_ce' ), $host ) ) );
								}
							}
							unset( $remote_timeout );
							if( ftp_login( $connection, $user, $pass ) ) {
								// Check if Transfer Mode is set to Auto/Pasive and if passive mode is available
								if( in_array( $passive, array( 'auto', 'passive' ) ) ) {
									$features = ftp_raw( $connection, 'FEAT' );
									if( !empty( $features ) ) {
										if( in_array( 'PASV', $features ) ) {
											if( ftp_pasv( $connection, true ) == false )
												error_log( sprintf( '[store-exporter-deluxe] %s: Warning: %s', 'woo_ce', $export->filename, sprintf( __( 'Could not switch to FTP passive mode on %s', 'woo_ce' ), $host ) ) );
										}
									}
								}
								// Change directory if neccesary
								if( !empty( $directory ) ) {
									$current_directory  = ftp_pwd( $connection );
									if( $current_directory !== false && @ftp_chdir( $connection, $path ) )
										ftp_chdir( $connection, $path );
								}
								if( ftp_put( $connection, sprintf( '%s/%s', $path, $export->filename ), $upload['file'], FTP_ASCII ) ) {
									error_log( sprintf( '[store-exporter-deluxe] %s: Success: %s', $export->filename, sprintf( __( 'Scheduled export of %s to %s via FTP uploaded', 'woo_ce' ), $export->filename, $path ) ) );
								} else {
									$export->error = sprintf( __( 'There was a problem uploading %s to %s via FTP, response: %s', 'woo_ce' ), $export->filename, $path, woo_ce_error_get_last_message() );
									error_log( sprintf( '[store-exporter-deluxe] %s: Error: %s', $export->filename, $export->error ) );
								}
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:67,代码来源:cron.php

示例12: setOptionValue

 /**
  * Sets FTP option value
  *
  * @param int $option Option id. Supported are: <code>FTP_TIMEOUT_SEC</code>, <code>FTP_AUTOSEEK</code>
  * @param type $value Value to set
  * @throws cFTP_Exception
  * 
  * @return cFTP_Session This
  */
 public function setOptionValue( $option, $value )
 {
     $success = @ftp_get_option($this->handle, $option, $value);
     
     if( $success === false )
         throw new cFTP_Exception( "Could not set option value", 10 );
     
     return $this;
 }
开发者ID:robik,项目名称:cFTP,代码行数:18,代码来源:Session.php

示例13: getOption

 /**
  * Retrieves various runtime behaviours of the current FTP stream
  * TIMEOUT_SEC | AUTOSEEK
  *
  * @param mixed $option
  *
  * @return mixed
  */
 public function getOption($option)
 {
     switch ($option) {
         case FTPClient::TIMEOUT_SEC:
         case FTPClient::AUTOSEEK:
             $result = @ftp_get_option($this->connection, $option);
             return $result;
             break;
         default:
             throw new Exception('Unsupported option');
             break;
     }
 }
开发者ID:melihucar,项目名称:ftpclient,代码行数:21,代码来源:FtpClient.php

示例14: var_dump

<?php

$ftp = null;
var_dump(ftp_connect(array()));
var_dump(ftp_connect('127.0.0.1', 0, -3));
var_dump(ftp_raw($ftp));
var_dump(ftp_mkdir($ftp));
var_dump(ftp_rmdir($ftp));
var_dump(ftp_nlist($ftp));
var_dump(ftp_rawlist($ftp));
var_dump(ftp_fget($ftp));
var_dump(ftp_nb_fget($ftp));
var_dump(ftp_nb_get($ftp));
var_dump(ftp_pasv($ftp));
var_dump(ftp_nb_continue());
var_dump(ftp_fput());
var_dump(ftp_nb_fput($ftp));
var_dump(ftp_put($ftp));
var_dump(ftp_nb_put($ftp));
var_dump(ftp_size($ftp));
var_dump(ftp_mdtm($ftp));
var_dump(ftp_rename($ftp));
var_dump(ftp_site($ftp));
var_dump(ftp_set_option($ftp));
var_dump(ftp_get_option($ftp));
开发者ID:badlamer,项目名称:hhvm,代码行数:25,代码来源:006.php

示例15: get_option

 /**
  *    获取FTP选项
  *
  *    @author    Garbin
  *    @param     string $option
  *    @return    mixed
  */
 function get_option($option)
 {
     return ftp_get_option($this->_connection, $option);
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:11,代码来源:ftp_server.lib.php


注:本文中的ftp_get_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。