本文整理匯總了PHP中Net_SFTP::stat方法的典型用法代碼示例。如果您正苦於以下問題:PHP Net_SFTP::stat方法的具體用法?PHP Net_SFTP::stat怎麽用?PHP Net_SFTP::stat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Net_SFTP
的用法示例。
在下文中一共展示了Net_SFTP::stat方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: stat
public function stat($path)
{
try {
$stat = $this->client->stat($this->absPath($path));
$mtime = $stat ? $stat['mtime'] : -1;
$size = $stat ? $stat['size'] : 0;
return array('mtime' => $mtime, 'size' => $size, 'ctime' => -1);
} catch (\Exception $e) {
return false;
}
}
示例2: stat
/**
* Returns the stat information of the given path.
* It also sets the cache for the fileExists command.
*
* NOTE: the returned array structure depends on the current connection type
*
* @param string $path
*
* @return false|array
*/
public function stat($path)
{
$stat = $this->_getFromCache(__FUNCTION__, $path);
if ($stat === null) {
switch ($this->_connType) {
case SftpHelper::TYPE_SFTP:
default:
$stat = $this->_connection->stat($path);
break;
case SftpHelper::TYPE_FTP:
$stat = false;
if ($this->fileExists($path)) {
$stat = stat($this->_getStreamUrl($path));
}
break;
}
Log::logger()->addDebug('Performing ' . __METHOD__ . ' // result: {stat}', ['stat' => var_export($stat, true), 'path' => $path]);
$this->_addToCache(__FUNCTION__, $path, $stat);
$this->_addToCache('fileExists', $path, isset($stat['size']) ? true : false);
}
return $stat;
}
示例3: url_stat
/**
* This method is called in response to all stat() related functions
*
* Retrieves information about a file
*
* @see SFTP_StreamWrapper::stream_stat()
* @param String $path
* @param Integer $flags
* @return mixed
* @access public
*/
public function url_stat($path, $flags)
{
$connection = $this->stream_open($path, NULL, NULL, $opened_path);
if ($connection === false) {
return FALSE;
}
if ($flags === STREAM_URL_STAT_LINK) {
$stat = $this->sftp->lstat($this->path);
} else {
$stat = $this->sftp->stat($this->path);
}
$this->stream_close();
if (!empty($stat)) {
// mode fix
$stat['mode'] = $stat['permissions'];
unset($stat['permissions']);
return $stat;
} else {
return FALSE;
}
}