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


PHP ftp_exec函数代码示例

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


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

示例1: exec

 public function exec($command)
 {
     Logger::log('exec ' . $command);
     $result = ftp_exec($this->connectionId, $command);
     if (empty($result)) {
         Logger::log('exec command return false');
     }
     return $result;
 }
开发者ID:efabrikov,项目名称:filetransfer,代码行数:9,代码来源:FTP.php

示例2: exec

 public function exec($command)
 {
     if (!is_resource($this->resource)) {
         throw new ConnectionException('Connection is not open');
     }
     if (@ftp_exec($this->resource, $command)) {
         return '';
     } else {
         throw new ConnectionException('Unable to exec FTP command');
     }
 }
开发者ID:mazhuravlev,项目名称:file-transfer,代码行数:11,代码来源:FTPConnection.php

示例3: connect

 /**
  * Connect to ftp server
  *
  * @return bool
  * @author Dmitry (dio) Levashov
  * @author Naoki Sawada
  **/
 protected function connect()
 {
     if (!($this->connect = ftp_connect($this->options['host'], $this->options['port'], $this->options['timeout']))) {
         return $this->setError('Unable to connect to FTP server ' . $this->options['host']);
     }
     if (!ftp_login($this->connect, $this->options['user'], $this->options['pass'])) {
         $this->umount();
         return $this->setError('Unable to login into ' . $this->options['host']);
     }
     // try switch utf8 mode
     if ($this->encoding) {
         @ftp_exec($this->connect, 'OPTS UTF8 OFF');
     } else {
         @ftp_exec($this->connect, 'OPTS UTF8 ON');
     }
     // switch off extended passive mode - may be usefull for some servers
     @ftp_exec($this->connect, 'epsv4 off');
     // enter passive mode if required
     ftp_pasv($this->connect, $this->options['mode'] == 'passive');
     // enter root folder
     if (!@ftp_chdir($this->connect, $this->root) || $this->root != ftp_pwd($this->connect)) {
         if (empty($this->options['is_local']) || !$this->setLocalRoot()) {
             $this->umount();
             return $this->setError('Unable to open root folder.');
         }
     }
     // check for MLST support
     $features = ftp_raw($this->connect, 'FEAT');
     if (!is_array($features)) {
         $this->umount();
         return $this->setError('Server does not support command FEAT.');
     }
     foreach ($features as $feat) {
         if (strpos(trim($feat), 'MLST') === 0) {
             $this->MLSTsupprt = true;
             break;
         }
     }
     return true;
 }
开发者ID:nao-pon,项目名称:xelfinder,代码行数:47,代码来源:xelFinderVolumeFTP.class.php

示例4: connect

 /**
  * Connect to ftp server
  *
  * @return bool
  * @author Dmitry (dio) Levashov
  */
 public function connect()
 {
     static $connected = false;
     if ($connected) {
         return true;
     }
     if (!($this->connect = ftp_connect($this->options['host'], $this->options['port'], $this->options['timeout']))) {
         return $this->setError('Unable to connect to FTP server ' . $this->options['host']);
     }
     if (!ftp_login($this->connect, $this->options['user'], $this->options['pass'])) {
         $this->umount();
         return $this->setError('Unable to login into ' . $this->options['host']);
     }
     // switch off extended passive mode - may be usefull for some servers
     @ftp_exec($this->connect, 'epsv4 off');
     // enter passive mode if required
     ftp_pasv($this->connect, $this->options['mode'] == 'passive');
     // enter root folder
     if (!ftp_chdir($this->connect, $this->root) || $this->root != ftp_pwd($this->connect)) {
         $this->umount();
         return $this->setError('Unable to open root folder.');
     }
     $connected = parent::connect();
     return $connected;
 }
开发者ID:RyeZhu,项目名称:gpFinder,代码行数:31,代码来源:FinderVolumeFTP.class.php

示例5: exec

 /**
  * Sends a SITE EXEC command request to the FTP server.
  *
  * @param string    $command       FTP command (does not include <i>SITE EXEC</i> words).
  *
  * @throws FtpException If command execution fails.
  */
 public function exec($command)
 {
     $this->connectIfNeeded();
     $this->param = "SITE EXEC " . $command;
     $exec = true;
     if (!ftp_exec($this->handle, substr($command, strlen("SITE EXEC")))) {
         throw new FtpException(Yii::t('gftp', 'Could not execute command "{command}" on "{host}"', ['host' => $this->host, '{command}' => $this->param]));
     }
 }
开发者ID:komaspieler,项目名称:yii2-gftp,代码行数:16,代码来源:FtpDriver.php

示例6: executeCommand

 /**
  * Sends a SITE EXEC command to a FTP server.
  *
  * @param  string  $command The command that is send to the server.
  * @return bool
  */
 public function executeCommand($command)
 {
     if (is_resource($this->cid)) {
         return ftp_exec($this->cid, $command);
     }
 }
开发者ID:bergi9,项目名称:2Moons,代码行数:12,代码来源:ftp.class.php

示例7: execute

 /**
  * Execute a remote command on the FTP server.
  * 
  * @see		http://us2.php.net/manual/en/function.ftp-exec.php
  * @param	string remote command
  * @return	boolean
  */
 public function execute($command)
 {
     if ($this->getActive()) {
         // Execute command
         if (ftp_exec($this->_connection, $command)) {
             return true;
         } else {
             return false;
         }
     } else {
         throw new CDbException('EFtpComponent is inactive and cannot perform any FTP operations.');
     }
 }
开发者ID:mudiman,项目名称:yiirestintegrated,代码行数:20,代码来源:EFtpComponent.php

示例8: exec

 /**
  * Requests execution of a command
  * @link http://php.net/ftp_exec
  *
  * @param  string  $command The comman to execute
  * @return boolean TRUE on success, FALSE on failure
  */
 public function exec($command)
 {
     return ftp_exec($this->connection->getStream(), $command);
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:11,代码来源:FTPWrapper.php

示例9: exec

 /**
  * Execute an arbitrary command on the FTP server
  *
  * @param string command
  * @return mixed
  */
 protected function exec($cmd = null)
 {
     return ftp_exec($this->ftp, (string) $cmd);
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:10,代码来源:ftp.php

示例10: execCmd

 /**
  * Execute a remote command on the FTP server.
  * @see	http://us2.php.net/manual/en/function.ftp-exec.php
  * @param string remote command
  * @return boolean
  */
 public function execCmd($command)
 {
     if (ftp_exec($this->_connection, $command)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:amlap,项目名称:Yii-Extensions,代码行数:14,代码来源:XFtp.php

示例11: exec

 /**
  *    执行一个FTP命令
  *
  *    @author    Garbin
  *    @param     string $cmd
  *    @return    bool
  */
 function exec($cmd)
 {
     return ftp_exec($this->_connection, $cmd);
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:11,代码来源:ftp_server.lib.php

示例12: exec

 public function exec($command)
 {
     return ftp_exec($this->connection, $command);
 }
开发者ID:rendix2,项目名称:QW_MVS,代码行数:4,代码来源:FTPConnection.php

示例13: exec

 /**
  * execute commands on the server, ie. ls -al >files.txt
  *
  * @param $command   string 	The command to be executed
  * 
  * @return object
  */
 public function exec($command)
 {
     //check if exec has been enabled by the config
     if ($this->exec === false) {
         throw new MeagrException('Exec is currently disabled, tried to execute: "' . $command . '"');
         return false;
     }
     //see if the command was executed
     if (!ftp_exec($this->connection, $command)) {
         throw new MeagrException('Exec command "' . $command . '" could not be executed');
         return false;
     }
     return $this;
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:21,代码来源:ftp.php

示例14: ftp_connect

<?php

$bogus = 1;
require 'server.inc';
$ftp = ftp_connect('127.0.0.1', $port);
if (!$ftp) {
    die("Couldn't connect to the server");
}
var_dump(ftp_login($ftp, 'anonymous', 'mail@example.com'));
var_dump(ftp_alloc($ftp, 400));
var_dump(ftp_cdup($ftp));
var_dump(ftp_chdir($ftp, '~'));
var_dump(ftp_chmod($ftp, 0666, 'x'));
var_dump(ftp_delete($ftp, 'x'));
var_dump(ftp_exec($ftp, 'x'));
var_dump(ftp_fget($ftp, STDOUT, 'x', 0));
var_dump(ftp_fput($ftp, 'x', fopen(__FILE__, 'r'), 0));
var_dump(ftp_get($ftp, 'x', 'y', 0));
var_dump(ftp_mdtm($ftp, 'x'));
var_dump(ftp_mkdir($ftp, 'x'));
var_dump(ftp_nb_continue($ftp));
var_dump(ftp_nb_fget($ftp, STDOUT, 'x', 0));
var_dump(ftp_nb_fput($ftp, 'x', fopen(__FILE__, 'r'), 0));
var_dump(ftp_systype($ftp));
var_dump(ftp_pwd($ftp));
var_dump(ftp_size($ftp, ''));
var_dump(ftp_rmdir($ftp, ''));
开发者ID:badlamer,项目名称:hhvm,代码行数:27,代码来源:005.php

示例15: exec

 /**
  * @param $command
  *
  * @return string
  */
 public function exec($command)
 {
     $sftpDir = $this->pwd();
     switch ($this->_connType) {
         case SftpHelper::TYPE_SFTP:
         default:
             $execOutput = $this->_connection->exec('cd ' . $sftpDir . ' && ' . $command);
             $this->_lastExecExitStatus = $this->_connection->getExitStatus();
             break;
         case SftpHelper::TYPE_FTP:
             // TODO: test ftp_exec on a server which supports it
             $execOutput = '';
             $res = @ftp_exec($this->_connection, 'cd ' . $sftpDir . ' && ' . $command);
             $this->_lastExecExitStatus = $res ? 0 : 1;
             break;
     }
     return $execOutput;
 }
开发者ID:giovdk21,项目名称:deployii,代码行数:23,代码来源:SftpHelper.php


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