• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ftp_exec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了ftp_exec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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', '[email protected]'));
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


示例16: ftp_connect

<?php

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, 'user', 'pass'));
var_dump(ftp_systype($ftp));
/* some bogus usage */
var_dump(ftp_alloc($ftp, array()));
var_dump(ftp_cdup($ftp, 0));
var_dump(ftp_chdir($ftp, array()));
var_dump(ftp_chmod($ftp, 0666));
var_dump(ftp_get($ftp, 1234, 12));
var_dump(ftp_close());
var_dump(ftp_connect('sfjkfjaksfjkasjf'));
var_dump(ftp_delete($ftp, array()));
var_dump(ftp_exec($ftp, array()));
var_dump(ftp_systype($ftp, 0));
var_dump(ftp_pwd($ftp, array()));
var_dump(ftp_login($ftp));
var_dump(ftp_login($ftp, 'user', 'bogus'));
var_dump(ftp_quit($ftp));
开发者ID:badlamer,项目名称:hhvm,代码行数:24,代码来源:004.php


示例17: exec

 /**
  * Requests execution of a command on the FTP server
  *
  * @param string $command
  * 
  * @return FTPClient
  */
 public function exec($command)
 {
     $result = @ftp_exec($this->connection, $command);
     if ($result === false) {
         throw new Exception('Unable to exec command');
     }
     return $this;
 }
开发者ID:melihucar,项目名称:ftpclient,代码行数:15,代码来源:FtpClient.php


示例18:

             break;
         case '-3':
             $alertmsg = $lang['settings_attach_remote_pwderr'];
             break;
         case '-4':
             $alertmsg = $lang['settings_attach_remote_ftpoff'];
             break;
         default:
             $alertmsg = '';
     }
 }
 if (!$alertmsg) {
     if (!dftp_mkdir($ftp_conn_id, $testdir)) {
         $alertmsg = $lang['settings_attach_remote_mderr'];
     } else {
         if (!(function_exists('ftp_chmod') && dftp_chmod($ftp_conn_id, 0777, $testdir)) && !dftp_site($ftp_conn_id, "'CHMOD 0777 {$testdir}'") && !@ftp_exec($ftp_conn_id, "SITE CHMOD 0777 {$testdir}")) {
             $alertmsg = $lang['settings_attach_remote_chmoderr'] . '\\n';
         }
         $testfile = $testdir . '/' . $testfile;
         if (!dftp_put($ftp_conn_id, $testfile, DISCUZ_ROOT . './robots.txt', FTP_BINARY)) {
             $alertmsg .= $lang['settings_attach_remote_uperr'];
             dftp_delete($ftp_conn_id, $testfile);
             dftp_delete($ftp_conn_id, $testfile . '.uploading');
             dftp_delete($ftp_conn_id, $testfile . '.abort');
             dftp_rmdir($ftp_conn_id, $testdir);
         } else {
             if (!@readfile($settingsnew['ftp']['attachurl'] . '/' . $testfile)) {
                 $alertmsg .= $lang['settings_attach_remote_geterr'];
                 dftp_delete($ftp_conn_id, $testfile);
                 dftp_rmdir($ftp_conn_id, $testdir);
             } else {
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:31,代码来源:checktools.inc.php


示例19: cls_ftp

 $c_ftp = new cls_ftp();
 $conn_ret = $c_ftp->mconnect($ftp_host, $ftp_user, authcode($ftp_password, 'DECODE', md5($authkey)), $ftp_dir, $ftp_port, $ftp_pasv, $ftp_timeout, $ftp_ssl);
 if ($conn_ret == -1) {
     $checkmsg = 'settings_remote_1';
 } elseif ($conn_ret == -2) {
     $checkmsg = 'settings_remote_2';
 } elseif ($conn_ret == -3) {
     $checkmsg = 'settings_remote_3';
 } elseif ($conn_ret == -4) {
     $checkmsg = 'settings_remote_4';
 }
 if (!$checkmsg) {
     if (!$c_ftp->mmkdir($checkdir)) {
         $checkmsg = 'settings_remote_mderr';
     } else {
         if (!(function_exists('ftp_chmod') && $c_ftp->mchmod(0777, $checkdir)) && !$c_ftp->msite("'CHMOD 0777 {$checkdir}'") && !@ftp_exec($c_ftp->conn_id, "SITE CHMOD 0777 {$checkdir}")) {
             $checkmsg = 'settings_remote_chmoderr' . '\\n';
         }
         $checkfile = $checkdir . '/' . $checkfile;
         if (!$c_ftp->mput($checkfile, M_ROOT . './robots.txt', FTP_BINARY)) {
             $checkmsg .= 'settings_remote_uperr';
             $c_ftp->mdelete($checkfile);
             $c_ftp->mdelete($checkfile . '.uploading');
             $c_ftp->mdelete($checkfile . '.abort');
             $c_ftp->mrmdir($checkdir);
         } else {
             if (!@readfile($ftp_url . '/' . $checkfile)) {
                 $checkmsg .= 'settings_remote_geterr';
                 $c_ftp->mdelete($checkfile);
                 $c_ftp->mrmdir($checkdir);
             } else {
开发者ID:polarlight1989,项目名称:08cms,代码行数:31,代码来源:checks.inc.php


示例20: execute

 /**
  * This method tries executing a command on the ftp, using SITE EXEC.
  *
  * @access  public
  * @param   string $command The command to execute
  * @return  mixed           The result of the command (if successfull), otherwise PEAR::Error
  * @see     NET_FTP_ERR_EXEC_FAILED
  */
 function execute($command)
 {
     $res = @ftp_exec($this->_handle, $command);
     if (!$res) {
         return $this->raiseError("Execution of command '{$command}' failed.", NET_FTP_ERR_EXEC_FAILED);
     } else {
         return $res;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:17,代码来源:FTP.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_fget函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_delete函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap