本文整理汇总了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;
}
}