本文整理汇总了PHP中mysqli::fetchArray方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli::fetchArray方法的具体用法?PHP mysqli::fetchArray怎么用?PHP mysqli::fetchArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqli
的用法示例。
在下文中一共展示了mysqli::fetchArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _stat
/**
* Return stat for given path.
* Stat contains following fields:
* - (int) size file size in b. required
* - (int) ts file modification time in unix time. required
* - (string) mime mimetype. required for folders, others - optionally
* - (bool) read read permissions. required
* - (bool) write write permissions. required
* - (bool) locked is object locked. optionally
* - (bool) hidden is object hidden. optionally
* - (string) alias for symlinks - link target path relative to root path. optionally
* - (string) target for symlinks - link target path. optionally
*
* If file does not exists - returns empty array or false.
*
* @param string $path file path
* @return array|false
* @author Dmitry (dio) Levashov
**/
protected function _stat($path)
{
if ($path === '_') {
$cid = $lid = 0;
} else {
list($cid, $lid) = explode('_', substr($path, 1), 2);
list($lid) = explode('.', $lid);
}
$stat_def = array('size' => 0, 'ts' => 0, 'mime' => '', 'dirs' => 0, 'read' => true, 'write' => false, 'locked' => true, 'hidden' => false, 'url' => null);
if (!$cid) {
$stat['name'] = !empty($this->options['alias']) ? $this->options['alias'] : 'untitle';
$stat['mime'] = 'directory';
$stat['dirs'] = true;
$stat = array_merge($stat_def, $stat);
return $stat;
} elseif (!$lid) {
// cat (dirctory)
$sql = 'SELECT c.pid, c.cid, c.title as name , s.pid as dirs ' . 'FROM ' . $this->tbc . ' AS c ' . 'LEFT JOIN ' . $this->tbc . ' AS s ON c.cid=s.pid ' . 'WHERE c.cid="' . $cid . '" LIMIT 1';
$res = $this->query($sql);
if ($res) {
$stat = $this->db->fetchArray($res);
$stat = array_merge($stat_def, $stat);
$stat['mime'] = 'directory';
$stat['dirs'] = $stat['dirs'] ? 1 : 0;
if (!$stat['pid']) {
$stat['phash'] = $this->encode('_');
} else {
$stat['phash'] = $this->encode('_' . $stat['pid'] . '_');
}
unset($stat['cid'], $stat['pid']);
return $stat;
}
} elseif ($cid) {
// photos
$sql = 'SELECT submitter as uid, lid, cid, concat( lid, ".", ext ) AS id, res_x AS width, res_y AS height, `date` AS ts, concat( title, ".", ext ) AS name
FROM ' . $this->tbf . '
WHERE lid="' . $lid . '" AND status>0 LIMIT 1';
$res = $this->query($sql);
if ($res) {
$stat = $this->db->fetchArray($res);
$stat = array_merge($stat_def, $stat);
$stat['phash'] = $this->encode('_' . $cid . '_');
$stat['url'] = $this->options['URL'] . $stat['id'];
$realpath = realpath($this->options['filePath'] . $stat['id']);
$stat['size'] = filesize($realpath);
$stat['mime'] = $this->mimetypeInternalDetect($stat['id']);
$stat['simg'] = trim($this->options['smallImg'], '/');
$stat['owner'] = xoops_elFinder::getUnameByUid($stat['uid']);
$stat['tooltip'] = 'Owner: ' . $stat['owner'];
unset($stat['uid'], $stat['lid'], $stat['cid'], $stat['id']);
return $stat;
}
}
return array();
}
示例2: _stat
/**
* Return stat for given path.
* Stat contains following fields:
* - (int) size file size in b. required
* - (int) ts file modification time in unix time. required
* - (string) mime mimetype. required for folders, others - optionally
* - (bool) read read permissions. required
* - (bool) write write permissions. required
* - (bool) locked is object locked. optionally
* - (bool) hidden is object hidden. optionally
* - (string) alias for symlinks - link target path relative to root path. optionally
* - (string) target for symlinks - link target path. optionally
*
* If file does not exists - returns empty array or false.
*
* @param string $path file path
* @return array|false
* @author Dmitry (dio) Levashov
**/
protected function _stat($path, $rootCheck = true) {
$sql = 'SELECT f.file_id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime,
f.perm, f.umask, f.uid, f.gid, f.home_of, f.width, f.height, f.gids, f.mime_filter as filter, f.local_path,
IF(ch.file_id, 1, 0) AS dirs
FROM '.$this->tbf.' AS f
LEFT JOIN '.$this->tbf.' AS p ON p.file_id=f.parent_id
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.file_id AND ch.mime="directory"
WHERE f.file_id="'.$path.'"
GROUP BY f.file_id';
$res = $this->query($sql);
if ($res && $stat = $this->db->fetchArray($res)) {
return $this->makeStat($stat);
} else if ($rootCheck && $path == $this->root) {
$this->_mkdir(0, 'VolumeRoot');
return $this->_stat($path, false);
}
return array();
}