本文整理汇总了PHP中size函数的典型用法代码示例。如果您正苦于以下问题:PHP size函数的具体用法?PHP size怎么用?PHP size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: average
function average($collection)
{
$size = size($collection);
if ($size === 0) {
return 0;
} else {
return sum($collection) / $size;
}
}
示例2: fileList
function fileList()
{
global $DB;
$key = $_REQUEST['key'];
$ba = urlencode('查看列表');
$n = $DB->count("SELECT count(*) from udisk WHERE 1");
echo "<div class='title'>文件列表(共有{$n}个文件)</div>";
echo "<a href=\"admin.php?a=1&act={$ba}&key={$key}\">刷新列表</a><br/>";
global $pagesize;
$numrows = $n;
$pages = intval($numrows / $pagesize);
if ($numrows % $pagesize) {
$pages++;
}
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
$offset = $pagesize * ($page - 1);
$rs = $DB->query("select * from udisk where 1 order by datetime desc limit {$offset},{$pagesize}");
$i = 0;
while ($myrow = $DB->fetch($rs)) {
$i++;
$pagesl = $i + ($page - 1) * $pagesize;
$size = size($myrow['size']);
$ext = '.' . $myrow['type'];
if ($myrow['pwd'] != null) {
$pwd_ext1 = '&' . $myrow['pwd'];
$pwd_ext2 = '&pwd=' . $myrow['pwd'];
}
echo '<div class="content">' . $i . '.<a href="../down.php/' . $myrow['fileurl'] . $ext . $pwd_ext1 . '">' . $myrow['filename'] . '</a>(' . $size . ')-';
echo '<a href="admin.php?a=1&key=' . $key . '&act=read&name=' . $myrow['fileurl'] . $pwd_ext2 . '">查看</a>.<a href="admin.php?a=1&key=' . $key . '&act=del1&name=' . $myrow['fileurl'] . '">删除</a></div>';
}
echo '<div class="pages">共有' . $pages . '页(' . $page . '/' . $pages . ')';
$first = 1;
$prev = $page - 1;
$next = $page + 1;
$last = $pages;
if ($page > 1) {
echo ' <a href="admin.php?a=1&act=查看列表&key=' . $key . '&page=' . $first . '">首页</a>.';
echo '<a href="admin.php?a=1&act=查看列表&key=' . $key . '&page=' . $prev . '">上一页</a>';
}
if ($page < $pages) {
echo ' <a href="admin.php?a=1&act=查看列表&key=' . $key . '&page=' . $next . '">下一页</a>.';
echo '<a href="admin.php?a=1&act=查看列表&key=' . $key . '&page=' . $last . '">尾页</a>';
}
echo '</div>';
foot();
}
示例3: title
function title($title)
{
print "<HTML>";
print "<link href='styles/style.css' rel='stylesheet' type='text/css'>";
print "<body>";
print "<h2 style='font-size:750%'>" . $title . "</h2>";
print "<br>";
print "Seeding: ";
$size = size();
print $size;
print "GB | ";
print "<a href='index.php'>Home</a> | ";
print '<a href="remove.php">Eligible</a> | <a href="main.php">Update</a> |
<a href="showdeleted.php">Show Deleted</a> | <a
href="add.php">Add</a> | <a href="prune.php">Prune</a><br>';
}
示例4: fileList
function fileList()
{
global $DB;
$n = $DB->count("SELECT count(*) from udisk WHERE 1");
echo "<div class='title'>文件列表(共有{$n}个文件)</div>";
global $pagesize;
$numrows = $n;
$pages = intval($numrows / $pagesize);
if ($numrows % $pagesize) {
$pages++;
}
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
$offset = $pagesize * ($page - 1);
$rs = $DB->query("select * from udisk where hide=0 order by datetime desc limit {$offset},{$pagesize}");
$i = 0;
while ($myrow = $DB->fetch($rs)) {
$i++;
$pagesl = $i + ($page - 1) * $pagesize;
$size = size($myrow['size']);
$ext = '.' . $myrow['type'];
echo '<div class="content">' . $i . '.<a href="../down.php/' . $myrow['fileurl'] . $ext . '">' . $myrow['filename'] . '</a>(' . $size . ')-<a href="list.php?act=view&name=' . $myrow['fileurl'] . '">查看</a></div>';
}
echo '<div class="pages">共有' . $pages . '页(' . $page . '/' . $pages . ')';
$first = 1;
$prev = $page - 1;
$next = $page + 1;
$last = $pages;
if ($page > 1) {
echo ' <a href="list.php?page=' . $first . '">首页</a>.';
echo '<a href="list.php?page=' . $prev . '">上一页</a>';
}
if ($page < $pages) {
echo ' <a href="list.php?page=' . $next . '">下一页</a>.';
echo '<a href="list.php?page=' . $last . '">尾页</a>';
}
echo '</div>';
foot();
}
示例5: median
function median($collection)
{
$size = size($collection);
if ($size === 0) {
$median = null;
} else {
$sorted = values(sort($collection));
if ($size % 2 === 0) {
// For an even number of values,
// the median is the average of the middle two values
$start = $size / 2 - 1;
$end = $start + 1;
$median = average(array(at($sorted, $start), at($sorted, $end)));
} else {
// For an odd number of values,
// the median is the middle value
$index = floor($size / 2);
$median = at($sorted, $index);
}
}
return $median;
}
示例6: sql_files
function sql_files()
{
$files = dir_read('.', null, array('.sql'));
$files2 = array();
foreach ($files as $file) {
$files2[md5($file)] = $file . sprintf(' (%s)', size(filesize($file)));
}
return $files2;
}
示例7: isEmpty
/**
* Returns true if this set contains no elements.
*/
public function isEmpty()
{
return $this->set - size() == 0 ? true : false;
}
示例8: while
while ($row_reference = mysqli_fetch_array($query_reference, MYSQLI_BOTH)) {
echo $row_reference['clanak_text'];
}
?>
</div>
<!-------------------------- DIV 4-------------------------------------------->
<div id="download" class="tabcontent">
Ovdje možete preuzeti elektronske dokumente:<br><br>
<?php
$row_download = mysqli_fetch_array($query_download, MYSQLI_BOTH);
$download_content = $row_download['clanak_text'];
$download_document = explode(";", $download_content);
for ($i = 0; $i < count($download_document); $i++) {
$document_path_n_title = explode(",", $download_document[$i]);
$pdf_full_path = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT') . $document_path_n_title[0];
$pdf_size = size($pdf_full_path);
echo '<ul>
<li>
<img alt="" class="pdfImg" src="/img/icons/pdf.jpg">
<a href="' . $document_path_n_title[0] . '" target="_blank" title="' . $document_path_n_title[1] . '">' . $document_path_n_title[1] . ' ' . $pdf_size . '
</a>
</li>
</ul>';
}
?>
</div>
<!-------------------------- DIV 5-------------------------------------------->
<div id="kontakt" class="tabcontent">
<?php
while ($row_kontakt = mysqli_fetch_array($query_kontakt, MYSQLI_BOTH)) {
echo '<a id="' . $row_kontakt['clanak_naslov'] . '"></a>';
示例9: insertNewAsset
function insertNewAsset($config, $db, $user, $category, $asset)
{
/* see if there's an entry with the specified identifier already */
$r = $db->GetRecords("SELECT * FROM `{$category}` WHERE identifier='{$asset['Identifier']}' LIMIT 1");
if ($r === false) {
return SLAM_makeErrorHTML('Database error: could not check for duplicate identifiers: ' . $db->ErrorState(), true);
}
if (count($r) > 0) {
// pre-existing entry with that identifier!, get next highest asset number and regenerate identifier
if (($results = $db->Query("SHOW TABLE STATUS WHERE `name`='{$category}'")) === false) {
return SLAM_makeErrorHTML('Database error: error retrieving table status:' . $db->ErrorState(), true);
}
if (size($results) == 0) {
return SLAM_makeErrorHTML('Database error: could not get table\'s next available identifier.', true);
} else {
$row = $results[0];
$asset['Serial'] = $row['Auto_increment'];
$asset['Identifier'] = "{$config->values['lab_prefix']}{$config->categories[$category]['prefix']}_{$row['Auto_increment']}";
}
}
/* separate the permissions from the asset attributes to be saved */
$permissions = (array) $asset['permissions'];
unset($asset['permissions']);
/* insert the asset attributes into the database */
$q = SLAM_makeInsertionStatement($db, 'INSERT', $category, $asset);
if ($db->Query($q) === false) {
return SLAM_makeErrorHTML('Database error: could not save record: ' . $db->ErrorState(), true);
}
/* save the permissions as well */
$asset['permissions'] = $permissions;
if (($ret = SLAM_saveAssetPerms($config, $db, $asset)) !== true) {
return $ret;
}
return True;
}
示例10: fileList
function fileList()
{
global $DB;
$key = $_REQUEST['key'];
$ba = urlencode('查看列表');
$n = $DB->count("SELECT count(*) from udisk WHERE 1");
echo "<p>以下是本站全部已上传文件列表 共有{$n}个文件!(<a href=\"admin.php?a=1&act={$ba}&key={$key}\">刷新列表</a>)</p>";
echo '<table class="table">';
echo '<tr><td>序号</td><td>操作</td><td>文件名</td><td>文件大小</td><td>上传日期时间</td><td>文件格式</td><td>上传者IP</td></tr>';
global $pagesize;
$numrows = $n;
$pages = intval($numrows / $pagesize);
if ($numrows % $pagesize) {
$pages++;
}
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
$offset = $pagesize * ($page - 1);
$rs = $DB->query("select * from udisk where 1 order by datetime desc limit {$offset},{$pagesize}");
$i = 0;
while ($myrow = $DB->fetch($rs)) {
$i++;
$pagesl = $i + ($page - 1) * $pagesize;
$size = size($myrow['size']);
if ($myrow['pwd'] != null) {
$pwd_ext1 = '&' . $myrow['pwd'];
$pwd_ext2 = '&pwd=' . $myrow['pwd'];
}
$type = $myrow['type'];
if ($type != NULL) {
$type = '.' . $type;
} else {
$type = '未知';
}
$ext = '.' . $myrow['type'];
echo '<tr><td>' . $i . '</td><td><a href="down.php/' . $myrow['fileurl'] . $ext . $pwd_ext1 . '">下载</a> | <a href="admin.php?a=1&key=' . $key . '&act=read&name=' . $myrow['fileurl'] . $pwd_ext2 . '">查看</a> | <a href="admin.php?a=1&key=' . $key . '&act=del1&name=' . $myrow['fileurl'] . '">删除</a></td><td>' . $myrow['filename'] . '</td><td>' . $size . '</td><td>' . $myrow['datetime'] . '</td><td>' . $type . '</td><td><a href="http://www.ip138.com/ips138.asp?ip=' . $myrow['ip'] . '" target="_blank">' . $myrow['ip'] . '</a></td></tr>';
}
echo '</table>';
echo "共有" . $pages . "页(" . $page . "/" . $pages . ")<br>";
for ($i = 1; $i < $page; $i++) {
echo "<a href='admin.php?a=1&act=查看列表&key=" . $key . "&page=" . $i . "'>[" . $i . "]</a> ";
}
echo "[" . $page . "]";
for ($i = $page + 1; $i <= $pages; $i++) {
echo "<a href='admin.php?a=1&act=查看列表&key=" . $key . "&page=" . $i . "'>[" . $i . "]</a> ";
}
echo '<br>';
$first = 1;
$prev = $page - 1;
$next = $page + 1;
$last = $pages;
if ($page > 1) {
echo "<a href='admin.php?a=1&act=查看列表&key=" . $key . "&page=" . $first . "'>首页</a>.";
echo "<a href='admin.php?a=1&act=查看列表&key=" . $key . "&page=" . $prev . "'>上一页</a>";
}
if ($page < $pages) {
echo "<a href='admin.php?a=1&act=查看列表&key=" . $key . "&page=" . $next . "'>下一页</a>.";
echo "<a href='admin.php?a=1&act=查看列表&key=" . $key . "&page=" . $last . "'>尾页</a>";
}
}
示例11: freeblock_to_graph
if ($config['percent_graph_type'] == 'used') {
// swap
$tmp = $pvalue;
$pvalue = $pempty;
$pempty = $tmp;
}
$w = $config['percent_graph_width'] + 2;
if (empty($ci['istotal'])) {
$graph = freeblock_to_graph($ci['free_blocks'], $ci['size']);
$blocksgraph = "<div class=\"blocksgraph\" style=\"width: {$w}px\">{$graph}</div>";
} else {
$blocksgraph = '';
}
$ci_slots = size($ci['slots']);
$ci_size = size($ci['size']);
$ci_avail = size($ci['avail']);
$ci = number_formats($ci, $numkeys);
$hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2);
$hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2);
$hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour');
if (!empty($ci['istotal'])) {
$ci['status'] = '-';
$ci['can_readonly'] = '-';
} else {
if ($ci['disabled']) {
$ci['status'] = $l_disabled . sprintf("(%s)", age($ci['disabled']));
} else {
if ($ci['type'] == XC_TYPE_PHP) {
$ci['status'] = $ci['compiling'] ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) : $l_normal;
} else {
$ci['status'] = '-';
示例12: function
}, 'email' => function ($value) {
return filter_var($value, FILTER_VALIDATE_EMAIL) !== false;
}, 'filename' => function ($value) {
return v::match($value, '/^[a-z0-9@._-]+$/i') && v::min($value, 2);
}, 'in' => function ($value, $in) {
return in_array($value, $in, true);
}, 'integer' => function ($value) {
return filter_var($value, FILTER_VALIDATE_INT) !== false;
}, 'ip' => function ($value) {
return filter_var($value, FILTER_VALIDATE_IP) !== false;
}, 'match' => function ($value, $preg) {
return preg_match($preg, $value) > 0;
}, 'max' => function ($value, $max) {
return size($value) <= $max;
}, 'min' => function ($value, $min) {
return size($value) >= $min;
}, 'notIn' => function ($value, $notIn) {
return !v::in($value, $notIn);
}, 'num' => function ($value) {
return is_numeric($value);
}, 'required' => function ($key, $array) {
return !empty($array[$key]);
}, 'same' => function ($value, $other) {
return $value === $other;
}, 'size' => function ($value, $size) {
return size($value) == $size;
}, 'url' => function ($value) {
// In search for the perfect regular expression: https://mathiasbynens.be/demo/url-regex
$regex = '_^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\x{00a1}-\\x{ffff}0-9]+-?)*[a-z\\x{00a1}-\\x{ffff}0-9]+)(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}0-9]+-?)*[a-z\\x{00a1}-\\x{ffff}0-9]+)*(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}]{2,})))(?::\\d{2,5})?(?:/[^\\s]*)?$_iu';
return preg_match($regex, $value) !== 0;
});
示例13: hasTraces
public function hasTraces()
{
$has = traces . size() > 0;
return $has;
}
示例14: size
<col width=90></col>
<?php
echo $hide_c_password_start;
?>
<td>Name :<br><?php
echo $c_name;
?>
</td><?php
echo $hide_c_password_end;
?>
<td><textarea name=memo cols=50 rows=4 style=width:100% class=textarea></textarea></td>
<?php
echo $hide_c_password_start;
?>
<td>Password :<br><input type=password name=password <?php
echo size(10);
?>
maxlength=20 class=input> </td><?php
echo $hide_c_password_end;
?>
<td><input type=submit value="Comment" accesskey="s" style=width=80;height=60 class=textarea></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width=11> </td>
</tr>
示例15: fecha_modificacion
echo " <tr style='z-index: -1'>\n <td class='tg-031e'><input type='checkbox' name='fichero[]' value='{$directorio_carpetas}'></td>\n <td class='tg-031e'><i class='fa fa-folder'></i></td>\n <td class='tg-031e'><a href='?d={$directorio}/{$nombre}'>" . $nombre . "</a></td>\n <td class='tg-031e'><a href='?d={$directorio}/{$nombre}'>Abrir directorio</a></td>\n <td class='tg-031e'>" . fecha_modificacion($directorio_carpetas) . "</td>\n <td class='tg-031e'>" . permisos($directorio_carpetas) . " / " . chmod_archivo($directorio_carpetas) . "</td>\n <td class='tg-031e'>" . usuario_archivo($directorio_carpetas) . "</td>\n <td class='tg-031e'>\n <div class='iconos'>\n <div class='boton_iconos' style='background:#2980b9'>\n <a title='Renombrar' href='#' data-toggle='modal' data-target='#" . evaluar($nombre) . "'><i class='fa fa-font'></i></a>\n </div>\n <div class='boton_iconos' style='background:#A3690C'>\n <a>-</a>\n </div>\n <div class='boton_iconos' style='background:#78271F'>\n <a href='?d={$directorio}/{$nombre}&dd={$directorio}/{$nombre}'><i class='fa fa-trash-o'></i></a>\n </div>\n <div class='boton_iconos' style='background:#502661'>\n <a href='?d={$directorio}&dc={$directorio}/{$nombre}'><i class='fa fa-download'></i></a>\n </div>\n </div>\n </td>\n\n\n </tr>\n ";
/*Modal renombrar*/
echo "\n <div class='modal fade' id='" . evaluar($nombre) . "' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n <div class='modal-dialog'>\n <div class='modal-content'>\n <div class='modal-header'>\n <center><h4 class='modal-title'>Renombrar</h4></center>\n </div>\n <div class='modal-body'>\n <form action='' method='post'>\n <br>\n <input style='padding:10px' type='text' name='renombrar' value='{$nombre}'>\n <input type='hidden' name='directorio' value='{$directorio}'>\n <input type='hidden' name='old' value='{$nombre}'>\n <br><br>\n </div>\n <div class='modal-footer'>\n <button type='button' class='btn-close' data-dismiss='modal'>Cancelar</button>\n <button type='submit' class='btn-edit' name='upload'>Renombrar</button>\n </form>\n </div>\n </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->\n </div><!-- /.modal -->\n ";
}
/* mostramos el contenido del array archivos */
echo "<ul>";
foreach ($archivos as $nombres) {
/* Obtenemos la ruta final del archivo */
$directorio_archivos = "{$directorio}/{$nombres}";
$extension = substr($nombres, strrpos($nombres, "."));
if ($extension == ".zip" or $extension == ".sql") {
$tr = "<tr style='background:#e74c3c'>";
} else {
$tr = "<tr>";
}
echo "{$tr}\n <td class='tg-031e'><input type='checkbox' name='fichero[]' value='{$directorio_archivos}'></td>\n <td class='tg-031e'>" . iconos($nombres) . "</td>\n <td class='tg-031e'><a target='_blank' href='?d={$directorio}&ea={$nombres}'>{$nombres}</a></td>\n <td class='tg-031e'>" . size($directorio_archivos) . "</td>\n <td class='tg-031e'>" . fecha_modificacion($directorio_archivos) . "</td>\n <td class='tg-031e'>" . permisos($directorio_archivos) . " / " . chmod_archivo($directorio_carpetas) . "</td>\n <td class='tg-031e'>" . usuario_archivo($directorio_carpetas) . "</td>\n\n <td class='tg-031e'>\n <div class='iconos'>\n <div class='boton_iconos'>\n <a href='#' data-toggle='modal' data-target='#" . evaluar($nombres) . "'><i class='fa fa-font'></i></a>\n </div>\n <div class='boton_iconos' style='background:#A3690C'>\n <a target='_blank' href='?d={$directorio}&ea={$nombres}'><i class='fa fa-pencil'></i></a>\n </div>\n <div class='boton_iconos' style='background:#78271F'>\n <a href='?d={$directorio}&df={$nombres}'><i class='fa fa-trash-o'></i></a>\n </div>\n <div class='boton_iconos' style='background:#502661'>\n <a href='?d={$directorio}&da={$nombres}'><i class='fa fa-download'></i></a>\n </div>\n </div>\n </td>\n </tr>";
echo "\n <div class='modal fade' id='" . evaluar($nombres) . "' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n <div class='modal-dialog'>\n <div class='modal-content'>\n <div class='modal-header'>\n <center><h4 class='modal-title'>Renombrar</h4></center>\n </div>\n <div class='modal-body'>\n <form action='' method='post'>\n <br>\n <input style='padding:10px' type='text' name='renombrar' value='{$nombres}'>\n <input type='hidden' name='directorio' value='{$directorio}'>\n <input type='hidden' name='old' value='{$nombres}'>\n <br><br>\n </div>\n <div class='modal-footer'>\n <button type='button' class='btn-close' data-dismiss='modal'>Cancelar</button>\n <button type='submit' class='btn-edit' name='upload'>Renombrar</button>\n </form>\n </div>\n </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->\n </div><!-- /.modal -->\n ";
}
echo "</table><br><button type='submit' name='seleccion'>Eliminar seleccion</button>\n \n <a target='_blank' href='?cf=true&d={$directorio}'><button type='button' name='crear_fichero'>Crear fichero</button></a>\n\n <button data-toggle='modal' data-target='#carpeta_nueva' type='button' name='crear_carpeta'>Crear carpeta</button>\n\n <button data-toggle='modal' data-target='#subir_archivo' type='button' name='crear_carpeta'>Subir archivo</button>\n\n </form>";
/*Modal subir archivo*/
echo '
<div class="modal fade" id="subir_archivo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<center><h4 class="modal-title">Subir archivo</h4></center>
</div>
<div class="modal-body">
<form action="" method="post" enctype="multipart/form-data">
<br>
<label for="logo_upload" class="btn-exito">Subir archivo</label>