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

PHP ftp_nb_fget函数代码示例

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

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



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

示例1: query

 function query($local_file, $remote_file)
 {
     if (!self::islogin()) {
         if (!self::login()) {
             return 0;
         }
     }
     self::$temp_file = $local_file . self::$suffix;
     self::$local_file = $local_file;
     //self::$ret = @ftp_nb_get(self::$cid, self::$temp_file, self::$root.$remote_file, FTP_BINARY);
     self::$fp = fopen(self::$temp_file, 'wb');
     self::$ret = @ftp_nb_fget(self::$cid, self::$fp, self::$root . $remote_file, FTP_BINARY);
     return self::$ret != FTP_FAILED;
 }
开发者ID:phateio,项目名称:php-radio-kernel,代码行数:14,代码来源:db_ftp.class.php


示例2: download_xu

 /**
  * XU_Ftp::download_xu()
  *
  * Download a file
  *
  * @access  public
  * @param   string	$remote_file	Remote filename
  * @param   string	$fid			File ID
  * @param   bool	$max_size		Max file size
  * @return  bool
  */
 public function download_xu($remote_file, $fid, $max_size)
 {
     if (!$this->_is_conn()) {
         return FALSE;
     }
     $result = TRUE;
     // if no filepointer is given, make a temp file and open it for writing
     $tmpfname = tempnam(ROOTPATH . '/temp', "RFT-");
     $l_fp = fopen($tmpfname, "wb");
     // Initate the download
     $i = 0;
     $CI =& get_instance();
     $ret = ftp_nb_fget($this->conn_id, $l_fp, $remote_file, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         if ($i % 10 == 0) {
             $fstat = fstat($l_fp);
             $p = $fstat[7];
             $CI->db->where('fid', $fid);
             $CI->db->update('progress', array('progress' => $p, 'curr_time' => time()));
         }
         // Continue downloading...
         $ret = ftp_nb_continue($this->conn_id);
         $i++;
     }
     // Has it finished completly?
     if ($ret != FTP_FINISHED) {
         log_message('error', "FTP TRANSFER FAILED");
         $result = FALSE;
     }
     if ($result === FALSE) {
         if ($this->debug == TRUE) {
             $msg = 'ftp_unable_to_download';
             $this->_error($msg);
         } else {
             $this->error = TRUE;
             $this->error_msg = 'ftp_unable_to_download';
         }
         return FALSE;
     }
     return $tmpfname;
 }
开发者ID:rexcarnation,项目名称:XtraUpload-1,代码行数:52,代码来源:XU_Ftp.php


示例3: nbFget

 /**
  * 从检索FTP服务器上的文件并将其写入一个打开的文件(非阻塞)
  *
  * @param resource $handle
  * @param string $remote_file
  * @param int $mode
  * @param int $resumepos
  * @return int 返回ftp_failed或ftp_finished或ftp_moredata
  */
 public static function nbFget($handle, $remote_file, $mode = FTP_ASCII, $resumepos = 0)
 {
     return ftp_nb_fget(self::$resource, $handle, $remote_file, $mode, $resumepos);
 }
开发者ID:luozhanhong,项目名称:share,代码行数:13,代码来源:ftp.php


示例4: get

 public function get($local_file_path, $remote_file_path, $mode = FTP_BINARY, $resume = false, $updraftplus = false)
 {
     $file_last_size = 0;
     if ($resume) {
         if (!($fh = fopen($local_file_path, 'ab'))) {
             return false;
         }
         clearstatcache($local_file_path);
         $file_last_size = filesize($local_file_path);
     } else {
         if (!($fh = fopen($local_file_path, 'wb'))) {
             return false;
         }
     }
     // Implicit FTP, for which we use curl (since PHP's native FTP functions don't handle implicit FTP)
     if ($this->curl_handle) {
         if ($resume) {
             curl_setopt($this->curl_handle, CURLOPT_RESUME_FROM, $resume);
         }
         curl_setopt($this->curl_handle, CURLOPT_NOBODY, false);
         curl_setopt($this->curl_handle, CURLOPT_URL, 'ftps://' . $this->host . '/' . $remote_file_path);
         curl_setopt($this->curl_handle, CURLOPT_UPLOAD, false);
         curl_setopt($this->curl_handle, CURLOPT_FILE, $fh);
         $output = curl_exec($this->curl_handle);
         if ($output) {
             if ($updraftplus) {
                 $updraftplus->log("FTP fetch: fetch complete");
             }
         } else {
             if ($updraftplus) {
                 $updraftplus->log("FTP fetch: fetch failed");
             }
         }
         return $output;
     }
     $ret = ftp_nb_fget($this->conn_id, $fh, $remote_file_path, $mode, $file_last_size);
     if (false == $ret) {
         return false;
     }
     while ($ret == FTP_MOREDATA) {
         if ($updraftplus) {
             $file_now_size = filesize($local_file_path);
             if ($file_now_size - $file_last_size > 524288) {
                 $updraftplus->log("FTP fetch: file size is now: " . sprintf("%0.2f", filesize($local_file_path) / 1048576) . " Mb");
                 $file_last_size = $file_now_size;
             }
             clearstatcache();
         }
         $ret = ftp_nb_continue($this->conn_id);
     }
     fclose($fh);
     if ($ret == FTP_FINISHED) {
         if ($updraftplus) {
             $updraftplus->log("FTP fetch: fetch complete");
         }
         return true;
     } else {
         if ($updraftplus) {
             $updraftplus->log("FTP fetch: fetch failed");
         }
         return false;
     }
 }
开发者ID:beyond-z,项目名称:braven,代码行数:63,代码来源:sftp.php


示例5: downloadToFileUnobtrusive

 /**
  * Downloads a file from the FTP server and saves to an open file but does not block other operations
  *
  * @param  string  $remotefile Remote path of the file to download
  * @param  string  $resource Resource handle of the open file in which the downloaded file should be written
  * @param  string  $mode Transfer mode for the file. (auto or ascii or binary)
  * @param  integer $position Pointer of the remote file from where the download should be resumed
  * @return integer 0 = Transfer failed (FTP_FAILED) | 1 = Transfer finished (FTP_FINISHED) | 2 = Transfer in progress (FTP_MOREDATA)
  */
 public function downloadToFileUnobtrusive($remotefile, $resource, $mode = 'auto', $position = null)
 {
     if (is_resource($this->cid)) {
         $transfermode = self::transferMode($mode);
         return ftp_nb_fget($this->cid, $resource, $remotefile, $transfermode, $position);
     }
 }
开发者ID:bergi9,项目名称:2Moons,代码行数:16,代码来源:ftp.class.php


示例6: fget

 /**
  * This function will download a file from the ftp-server. You can either spcify a absolute
  * path to the file (beginning with "/") or a relative one, which will be completed
  * with the actual directory you selected on the server. You can specify
  * the path to which the file will be downloaded on the local
  * maschine, if the file should be overwritten if it exists (optionally, default is
  * no overwriting) and in which mode (FTP_ASCII or FTP_BINARY) the file should be
  * downloaded (if you do not specify this, the method tries to determine it automatically
  * from the mode-directory or uses the default-mode, set by you). If you give a relative
  * path to the local-file, the script-path is used as basepath.
  *
  * @access  public
  * @param   string $remote_file The absolute or relative path to the file to download
  * @param   handle $local_hanlde  The local file pointer to put the downloaded in
  * @param   int    $mode        (optional) Either FTP_ASCII or FTP_BINARY
  * @return  mixed               True on success, otherwise PEAR::Error
  * @see     NET_FTP_ERR_OVERWRITELOCALFILE_FORBIDDEN, NET_FTP_ERR_OVERWRITELOCALFILE_FAILED, NET_FTP_ERR_OVERWRITELOCALFILE_FAILED
  */
 function fget($remote_file, $local_handle, $mode = null)
 {
     if (!isset($mode)) {
         $mode = $this->checkFileExtension($remote_file);
     }
     $remote_file = $this->_construct_path($remote_file);
     if (@function_exists('ftp_nb_fget')) {
         $res = @ftp_nb_fget($this->_handle, $local_handle, $remote_file, $mode);
         while ($res == FTP_MOREDATA) {
             $this->_announce('nb_fget');
             $res = @ftp_nb_continue($this->_handle);
         }
     } else {
         $res = @ftp_fget($this->_handle, $local_handle, $remote_file, $mode);
     }
     if (!$res) {
         return $this->raiseError("File '{$remote_file}' could not be downloaded.", NET_FTP_ERR_OVERWRITELOCALFILE_FAILED);
     } else {
         return true;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:39,代码来源:FTP.php


示例7: ftp_connect

<?php

require 'server.inc';
$ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) {
    die("Couldn't connect to the server");
}
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt";
file_put_contents($local_file, 'ASCIIFoo');
$handle = fopen($local_file, 'a');
var_dump(ftp_nb_fget($ftp, $handle, 'fgetresume.txt', FTP_ASCII, 8));
var_dump(file_get_contents($local_file));
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt");
开发者ID:alphaxxl,项目名称:hhvm,代码行数:14,代码来源:ftp_nb_fget_basic3.php


示例8: 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


示例9: getContents

 public function getContents($path)
 {
     $path = $this->path($path);
     // Create stack buffer
     Engine_Stream_Stack::registerWrapper();
     $stack = fopen('stack://tmp');
     if (!$stack) {
         throw new Engine_Vfs_Adapter_Exception(sprintf('Unable to create stack buffer'));
     }
     // Get mode
     $mode = $this->getFileMode($path);
     // Non-blocking mode
     if (@function_exists('ftp_nb_fget')) {
         $resource = $this->getResource();
         $res = @ftp_nb_fget($resource, $stack, $path, $mode);
         while ($res == FTP_MOREDATA) {
             //$this->_announce('nb_get');
             $res = @ftp_nb_continue($resource);
         }
         $return = $res === FTP_FINISHED;
     } else {
         $return = @ftp_fget($this->_handle, $stack, $path, $mode);
     }
     if (!$return) {
         throw new Engine_Vfs_Adapter_Exception(sprintf('Unable to get contents of "%s"', $path));
     }
     $data = '';
     while (false != ($dat = fread($stack, 1024))) {
         $data .= $dat;
     }
     return $data;
 }
开发者ID:robeendey,项目名称:ce,代码行数:32,代码来源:Ftp.php


示例10: get

 public function get($local_file_path, $remote_file_path, $mode = FTP_BINARY, $resume = false, $updraftplus = false)
 {
     $file_last_size = 0;
     if ($resume) {
         if (!($fh = fopen($local_file_path, 'ab'))) {
             return false;
         }
         clearstatcache($local_file_path);
         $file_last_size = filesize($local_file_path);
     } else {
         if (!($fh = fopen($local_file_path, 'wb'))) {
             return false;
         }
     }
     $ret = ftp_nb_fget($this->conn_id, $fh, $remote_file_path, $mode, $file_last_size);
     if (false == $ret) {
         return false;
     }
     while ($ret == FTP_MOREDATA) {
         if ($updraftplus) {
             $file_now_size = filesize($local_file_path);
             if ($file_now_size - $file_last_size > 524288) {
                 $updraftplus->log("FTP fetch: file size is now: " . sprintf("%0.2f", filesize($local_file_path) / 1048576) . " Mb");
                 $file_last_size = $file_now_size;
             }
             clearstatcache($local_file_path);
         }
         $ret = ftp_nb_continue($this->conn_id);
     }
     fclose($fh);
     if ($ret == FTP_FINISHED) {
         if ($updraftplus) {
             $updraftplus->log("FTP fetch: fetch complete");
         }
         return true;
     } else {
         if ($updraftplus) {
             $updraftplus->log("FTP fetch: fetch failed");
         }
         return false;
     }
 }
开发者ID:erikdukker,项目名称:medisom,代码行数:42,代码来源:ftp.class.php


示例11: ftp_nb_fget

 public function ftp_nb_fget($conn, $fp, $file, $mode)
 {
     return ftp_nb_fget($conn, $fp, $file, $mode);
 }
开发者ID:damijanc,项目名称:simple-ftp,代码行数:4,代码来源:FTPAdapter.php


示例12: 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


示例13: download_xu2

 /**
  * Download a file
  *
  */
 function download_xu2($remote_file, $fid, $max_size)
 {
     if (!$this->_is_conn()) {
         return FALSE;
     }
     $result = TRUE;
     // TODO: Make this use cache.
     $tmpfname = tempnam('./temp', 'RFT-');
     $l_fp = fopen($tmpfname, "wb");
     $i = 0;
     $CI =& get_instance();
     $ret = ftp_nb_fget($this->conn_id, $l_fp, $remote_file, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         if ($i % 10 == 0) {
             $fstat = fstat($l_fp);
             $p = $fstat[7];
             $CI->db->where('fid', $fid);
             $CI->db->update('progress', array('progress' => $p, 'curr_time' => time()));
         }
         // Continue downloading...
         $ret = ftp_nb_continue($this->conn_id);
         $i++;
     }
     if ($ret != FTP_FINISHED) {
         log_message('error', 'FTP TRANSFER FAILED');
         $result = FALSE;
     }
     if ($result === FALSE) {
         if ($this->debug == TRUE) {
             $msg = 'ftp_unable_to_download';
             $this->_error($msg);
         } else {
             $this->error = TRUE;
             $this->error_msg = 'ftp_unable_to_download';
         }
         return FALSE;
     }
     return $tmpfname;
 }
开发者ID:KasaiDot,项目名称:XtraUpload,代码行数:43,代码来源:XU_Ftp.php


示例14: download

 public function download()
 {
     // remove session
     if (isset($_SESSION['showDownload'])) {
         // reset session variable for next time
         $_SESSION['showDownload'] = null;
         unset($_SESSION['showDownload']);
         session_write_close();
     }
     // php script timeout for long downloads (2 days!)
     set_time_limit(60 * 60 * 24 * 2);
     // load the server the file is on
     $storageType = 'local';
     $storageLocation = _CONFIG_FILE_STORAGE_PATH;
     $uploadServerDetails = $this->loadServer();
     if ($uploadServerDetails != false) {
         $storageLocation = $uploadServerDetails['storagePath'];
         $storageType = $uploadServerDetails['serverType'];
         // if no storage path set & local, use system default
         if (strlen($storageLocation) == 0 && $storageType == 'local') {
             $storageLocation = _CONFIG_FILE_STORAGE_PATH;
         }
     }
     // get file path
     $fullPath = $this->getFullFilePath($storageLocation);
     // open file - via ftp
     if ($storageType == 'remote') {
         // connect via ftp
         $conn_id = ftp_connect($uploadServerDetails['ipAddress'], $uploadServerDetails['ftpPort'], 30);
         if ($conn_id === false) {
             $this->errorMsg = 'Could not connect to ' . $uploadServerDetails['ipAddress'] . ' to upload file.';
             return false;
         }
         // authenticate
         $login_result = ftp_login($conn_id, $uploadServerDetails['ftpUsername'], $uploadServerDetails['ftpPassword']);
         if ($login_result === false) {
             $this->errorMsg = 'Could not login to ' . $uploadServerDetails['ipAddress'] . ' with supplied credentials.';
             return false;
         }
         // prepare the stream of data
         $pipes = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);
         if ($pipes === false) {
             $this->errorMsg = 'Could not create stream to download file on ' . $uploadServerDetails['ipAddress'];
             return false;
         }
         stream_set_write_buffer($pipes[0], 10000);
         stream_set_timeout($pipes[1], 10);
         stream_set_blocking($pipes[1], 0);
         $fail = false;
         $ret = ftp_nb_fget($conn_id, $pipes[0], $fullPath, FTP_BINARY, FTP_AUTORESUME);
     } else {
         $handle = @fopen($fullPath, "r");
         if (!$handle) {
             $this->errorMsg = 'Could not open file for reading.';
             return false;
         }
     }
     // download speed
     $speed = 0;
     // if free/non user
     $Auth = Auth::getAuth();
     if ($Auth->loggedIn == false || $Auth->level == 'free user') {
         $speed = (int) SITE_CONFIG_FREE_USER_MAX_DOWNLOAD_SPEED;
     } else {
         $speed = (int) SITE_CONFIG_PREMIUM_USER_MAX_DOWNLOAD_SPEED;
     }
     // do we need to throttle the speed?
     if ($speed > 0) {
         // create new throttle config
         $config = new ThrottleConfig();
         // set standard transfer rate (in bytes/second)
         $config->burstLimit = $speed;
         $config->rateLimit = $speed;
         // enable module (this is a default value)
         $config->enabled = true;
         // start throttling
         $x = new Throttle($config);
     }
     // output some headers
     header("Expires: 0");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-type: " . $this->fileType);
     header("Pragma: public");
     header("Content-Disposition: attachment; filename=\"" . str_replace("\"", "", $this->originalFilename) . "\"");
     header("Content-Description: File Transfer");
     header("Content-Length: " . $this->fileSize);
     // output file - via ftp
     if ($storageType == 'remote') {
         while ($ret == FTP_MOREDATA) {
             $contents = stream_get_contents($pipes[1]);
             if ($contents !== false) {
                 echo $contents;
                 flush();
             }
             $ret = ftp_nb_continue($conn_id);
         }
         /*
          $contents = stream_get_contents($pipes[1]);
          if($contents !== false)
          {
//.........这里部分代码省略.........
开发者ID:farzam65,项目名称:YetiShare-File-Hosting-Script-Free,代码行数:101,代码来源:class.file.php


示例15: ftp_connect

<?php

require 'server.inc';
$ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) {
    die("Couldn't connect to the server");
}
ftp_set_option($ftp, FTP_AUTOSEEK, false);
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt";
$handle = fopen($local_file, 'w');
var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
var_dump(file_get_contents($local_file));
开发者ID:gleamingthecube,项目名称:php,代码行数:13,代码来源:ext_ftp_tests_ftp_nb_fget_basic1.php


示例16: fgetNb

 /**
  * Retrieves a remote file and writes it ton an open file (non-blocking)
  * @link http://php.net/ftp_nb_fget
  *
  * @param  resource $handle     An open file pointer in which we store the data
  * @param  string   $remoteFile The remote file path
  * @param  integer  $mode       The transfer mode (FTPWrapper::ASCII or FTPWrapper::BINARY)
  * @param  integer  $resumepos  The position in the remote file to start downloading from
  * @return integer  FTPWrapper::FAILED, FTPWrapper::FINISHED or FTPWrapper::MOREDATA
  */
 public function fgetNb($handle, $remoteFile, $mode = self::BINARY, $resumepos = 0)
 {
     return ftp_nb_fget($this->connection->getStream(), $handle, $remoteFile, $mode, $resumepos);
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:14,代码来源:FTPWrapper.php


示例17: getAsynchronously

 /**
  * @param $localFile
  * @param $remoteFile
  * @param int $mode
  * @return bool
  */
 public function getAsynchronously($localFile, $remoteFile, $mode = FTP_ASCII)
 {
     $localFilRes = fopen($localFile, 'w');
     return ftp_nb_fget($this->getFtp(), $localFilRes, $remoteFile, $mode);
 }
开发者ID:acassan,项目名称:remoteserver,代码行数:11,代码来源:Ftp.php


示例18: readLog

 /** Reads the log.
  * This function reads all the remaining log since last read (paying no attention to line returns). It also downloads it from an FTP server if specified.
  * 
  * \return The read data if averything passed correctly, FALSE otherwise. If no data has been read, it returns an empty string.
  */
 public function readLog()
 {
     switch ($this->_logfile['type']) {
         case 'ftp':
             //If we have finished to download the log, we read it and restart downloading
             if ($this->_logfile['state'] == FTP_FINISHED) {
                 $data = '';
                 //We read only if the pointer has changed, i.e. something has been downloaded.
                 if ($this->_logfile['pointer'] != ftell($this->_logfile['fp'])) {
                     fseek($this->_logfile['fp'], $this->_logfile['pointer']);
                     //Reset file pointer to last read position (ftp_nb_fget moves the pointer)
                     $data = '';
                     $read = NULL;
                     while ($read === NULL || $read) {
                         $read = fread($this->_logfile['fp'], 1024);
                         $data .= $read;
                     }
                     $this->_logfile['pointer'] = ftell($this->_logfile['fp']);
                     //Save new pointer position
                 }
                 //Calculation of new global pointer and sending command
                 $totalpointer = $this->_logfile['pointer'] + $this->_logfile['origpointer'];
                 $this->_logfile['state'] = ftp_nb_fget($this->_logfile['ftp'], $this->_logfile['fp'], $this->_logfile['location'], FTP_BINARY, $totalpointer);
                 return $data;
             } elseif ($this->_logfile['state'] == FTP_FAILED) {
                 Leelabot::message('Can\'t read the remote FTP log anymore.', array(), E_WARNING);
                 $this->openLogFile(TRUE);
                 return FALSE;
             } else {
                 $this->_logfile['state'] = ftp_nb_continue($this->_logfile['ftp']);
             }
             break;
         case 'file':
             $data = '';
             $read = NULL;
             while ($read === NULL || $read) {
                 $read = fread($this->_logfile['fp'], 1024);
                 $data .= $read;
             }
             return $data;
             break;
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:48,代码来源:instance.class.php


示例19: read

 /**
  * Read the previous scan results from the file system.
  *
  * @return array
  */
 public function read()
 {
     if (!$this->handle) {
         return false;
     }
     $stream = fopen('php://memory', 'w');
     if (!$stream) {
         return false;
     }
     $data = '';
     if ($ret = ftp_nb_fget($this->handle, $stream, $this->filename, $this->transfer_mode)) {
         while ($ret === FTP_MOREDATA) {
             rewind($stream);
             $data .= stream_get_contents($stream);
             $ret = ftp_nb_continue($this->handle);
         }
         if ($ret != FTP_FINISHED) {
             return false;
         } else {
             $data = (array) Yaml::parse($data);
             return Report\Report::fromArray($data);
         }
     }
     return false;
 }
开发者ID:johnnymast,项目名称:redbox-scan,代码行数:30,代码来源:Ftp.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_nb_get函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_nb_continue函数代码示例发布时间: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