本文整理汇总了PHP中formatSizeUnits函数的典型用法代码示例。如果您正苦于以下问题:PHP formatSizeUnits函数的具体用法?PHP formatSizeUnits怎么用?PHP formatSizeUnits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatSizeUnits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: itemProps
public function itemProps($itemId)
{
$itemId = trim($itemId, '/\\');
if ($this->fs->allow($itemId, $real)) {
return array_merge(parent::itemProps($itemId), array('inode' => $this->hasChildren($real, $icon), 'icon' => $icon, 'size' => is_file($real) ? formatSizeUnits(filesize($real)) : '', 'type' => recongnizeType($real), 'random' => mt_rand(0, 99)));
}
return parent::itemProps($itemId);
}
示例2: detail
function detail()
{
$id = $_GET['id'];
$where = "id = '" . $id . "' AND n_status = '1'";
$data = $this->models->getData(TRUE, '*', 'floraINA_digirepo', $where);
//pr($data);
if ($data) {
foreach ($data as $key => $value) {
$data[$key]['content'] = html_entity_decode($value['content'], ENT_QUOTES, 'UTF-8');
$data[$key]['filesize'] = formatSizeUnits($value['filesize']);
}
$this->view->assign('data', $data);
}
return $this->loadView('digirepo/reference_detail');
}
示例3: t
?>
</div>
<div id="content2">
<h1><?php
echo t('menu.main.agb');
?>
</h1>
<p><?php
echo t('page.agb.line1');
?>
</p>
<p><a href="<?php
echo $agb_pdf_filepath;
?>
" target="_blank"><?php
echo substr($agb_pdf_filename, 7) . ' (' . formatSizeUnits(filesize($agb_pdf_filepath), 1) . ')';
?>
</a></p>
</div>
<div id="nebennavigation"><div id="nebennavigationinnen"><?php
include 'inc/nebennavigation.php';
?>
</div> </div></div>
</div>
</body>
</html>
<?php
$thread_id = mysqli_thread_id($link);
mysqli_kill($link, $thread_id);
示例4: get_userdata
?>
?id=<?php
echo $post->post_author;
?>
">
<?php
$wp = get_userdata($post->post_author);
echo $wp->display_name;
?>
</a>
</div>
</td>
<td class="filesizetotal">
<?php
$meta = get_post_meta($post->ID, '_wp_collaboration_file_size', true);
echo formatSizeUnits($meta);
?>
</td>
<td class="fileslistoptions">
<div class="wrlistitemactionsholder">
<div class="fileslistoptionstxt wrlistitemactionstxt">
Options
</div>
<ul class="fileslistoptionsitems writemactionslist">
<li class="first"><a href="javascript:void(0);" data-file-id='<?php
echo $post->ID;
?>
' data-file-name="<?php
echo $post->post_title;
?>
" onClick="JavaScript:Edd.collaboration.FILES.DOWNLOAD_FILES(this);">Download File</a></li>
示例5: getEXT
<div class="box-notice iconFile <?php
echo $iconType;
?>
">
<div class="box-text">
<p class="text-title"><? echo $row['CONTENT_DESC'] ?></p>
<p class="text-detail">
<span><?php
echo $typeCap;
?>
: <? echo getEXT($IMG_PATH) ?></span>
<span><?php
echo $sizeCap;
?>
: <?php
echo formatSizeUnits(filesize($IMG_PATH));
?>
</span>
</p>
</div>
<div class="box-btn cf">
<a href="<?php
echo $IMG_PATH;
?>
" target="_blank" class="btn red"><?php
echo $downloadCap;
?>
</a>
</div>
</div>
示例6: uploadAjax
function uploadAjax()
{
global $basedomain;
$output_dir = $basedomain . "public_assets/tmp/";
if (isset($_FILES["myfile"])) {
$ret = array();
// This is for custom errors;
/* $custom_error= array();
$custom_error['jquery-upload-file-error']="File already exists";
echo json_encode($custom_error);
die();
*/
$error = $_FILES["myfile"]["error"];
//You need to handle both cases
//If Any browser does not support serializing of multiple files using FormData()
if (!is_array($_FILES["myfile"]["name"])) {
$upload = uploadFile('myfile', 'tmp');
$ret[0] = $upload['full_name'];
$ret[1] = $upload['real_name'];
$ret[2] = formatSizeUnits($_FILES["myfile"]["size"]);
} else {
$fileCount = count($_FILES["myfile"]["name"]);
for ($i = 0; $i < $fileCount; $i++) {
$upload = uploadFile('myfile', 'tmp');
$ret[0] = $upload['full_name'];
$ret[1] = $upload['real_name'];
$ret[2] = formatSizeUnits($_FILES["myfile"]["size"]);
}
}
echo json_encode($ret);
exit;
}
}
示例7: filesize
<?php
$path = "../admin_digilib/files/";
$filesize = filesize($path);
$filesizex = formatSizeUnits($filesize);
include "../admin_digilib/config/koneksi.php";
error_reporting(E_ALL ^ E_NOTICE);
session_start();
$member_id = $_SESSION['member_id'];
if (empty($_SESSION['member_id'])) {
header('location:../login_member.php');
}
$result = mysql_query("SELECT * from digilib_ebook");
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824) {
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
} elseif ($bytes >= 1048576) {
$bytes = number_format($bytes / 1048576, 2) . ' MB';
} elseif ($bytes >= 1024) {
$bytes = number_format($bytes / 1024, 2) . ' KB';
} elseif ($bytes > 1) {
$bytes = $bytes . ' B';
} elseif ($bytes == 1) {
$bytes = $bytes . ' B';
} else {
$bytes = '0 B';
}
return $bytes;
}
?>
示例8: foreach
<?php
foreach ($files as $one) {
?>
<tr>
<td><i class="fa <?php
echo font_awesome_file_icon_class($one->myme_type);
?>
"></i></td>
<td><strong><?php
echo $one->name;
?>
</strong></td>
<td>Файл</td>
<td><?php
echo formatSizeUnits($one->size);
?>
</td>
<td><?php
echo date('d.m.Y', strtotime($one->create_date));
?>
</td>
<td>
<a href="#"><i class="fa fa-eye"></i></a>
<a href="#"><i class="fa fa-link"></i></a>
<a href="#"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php
}
示例9: basename
<div class="col-sm-4">
<div class="ih-item square effect3 bottom_to_top" style="background-color: #bdc3c7;"><a>
<div class="img"><img src="<?php
echo $file;
?>
" alt="<?php
echo $file;
?>
"></div>
<div class="info">
<h3><?php
echo basename($file);
?>
</h3>
<p>Taille : <?php
echo formatSizeUnits(filesize($file));
?>
<button type="submit" class="btn btn-danger btn-modal" value="<?php
echo basename($file);
?>
" data-toggle="modal" data-target="#deleteModal">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
</button></p>
</div></a></div>
</div>
<?php
}
?>
</div>
示例10: the_content
the_content();
?>
</div>
<?php
if ($meta[attached_file][0] != '') {
?>
<div class="doc_cont">
<?php
$filename = $meta[attached_file][0];
$explode = explode('/', $meta[attached_file][0]);
$cv_format = end($explode);
$explode_dot = explode('.', $cv_format);
$extention = end($explode_dot);
$headers = get_headers($filename, 1);
$fsize = $headers['Content-Length'];
$mbytes = formatSizeUnits($fsize);
?>
<?php
if ($extention == 'docx' or $extention == 'doc') {
?>
<img src="<?php
echo get_bloginfo('url') . '/wp-content/themes/cafemocha/custom-images/word_icon.png';
?>
" />
<?php
} else {
if ($extention == 'pdf') {
?>
<img src="<?php
echo get_bloginfo('url') . '/wp-content/themes/cafemocha/custom-images/file_pdf.png';
?>
示例11: while
$hasil = $koneksi_db->sql_query("SELECT * FROM tugassiswa where tugas='{$idtugas}' order by id desc");
$admin .= '<div class="panel-heading"><b>Data Tugas</b></div>';
$admin .= '<table id="example" class="table table-striped table-hover">
<thead><tr>
<th width="20px">No</th>
<th>Nama</th>
<th>Kelas</th>
<th>Aksi</th>
</tr></thead><tbody>';
$no = 1;
while ($data = $koneksi_db->sql_fetchrow($hasil)) {
$nama = $data['nama'];
$kelas = $data['kelas'];
$file = $data['file'];
$ukuranfile = filesize('mod/tugas/download/' . $file . '');
$ukuranfile = formatSizeUnits($ukuranfile);
$detailbutton = '<a href="?pilih=tugas&mod=yes&aksi=detail&id=' . $data['id'] . '"><span class="btn btn-success">Detail</span></a>';
$admin .= '<tr>
<td><b>' . $no . '</b></td>
<td>' . $nama . '</td>
<td>' . $kelas . '</td>
<td>' . $detailbutton . '</td>
</tr>';
$no++;
}
$admin .= '</tbody></table>';
}
if ($_GET['aksi'] == "detail") {
$admin .= '<div class="panel-heading"><b>Data Tugas</b></div>';
$id = int_filter($_GET['id']);
$query = mysql_query("SELECT * FROM `tugassiswa` WHERE `id`='{$id}'");
示例12: get_workroom_space_details
function get_workroom_space_details($Workroom_Id)
{
$total_files = get_files($Workroom_Id);
$size = 0;
foreach ($total_files as $file) {
$size = $size + get_post_meta($file->ID, '_wp_collaboration_file_size', true);
}
$available_size = (int) get_option('allowed_space_in_gb');
$available_size_in_kb = $available_size * 1000000000;
$free_space = $available_size_in_kb - ($available_size_in_kb - $size);
$dp = sprintf('%.2f', $free_space / $available_size_in_kb * 100);
return array('UsedSpace' => $size, 'UsedSpaceWithUnit' => formatSizeUnits($size), 'UsedSpaceWithPercentage' => $dp, 'TotalSpace' => formatSizeUnits($available_size_in_kb));
}
示例13: number_format
if ($bytes >= 1073741824) {
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
} elseif ($bytes >= 1048576) {
$bytes = number_format($bytes / 1048576, 2) . ' MB';
} elseif ($bytes >= 1024) {
$bytes = number_format($bytes / 1024, 2) . ' KB';
} elseif ($bytes > 1) {
$bytes = round($bytes / 1024, 3) . ' KB';
} elseif ($bytes == 1) {
$bytes = $bytes . ' byte';
} else {
$bytes = '0 bytes';
}
return $bytes;
}
echo "Bestandsgrootte: " . formatSizeUnits(filesize($dir . "\\" . $bestandsnaam)) . "<br />";
//Laatste bewerkt:
$tijd = date("d F Y - H:i:s", filemtime($map . "\\" . $bestandsnaam));
echo "Laatst aangepast: " . $tijd . "<br />";
//Images uit de map
if ($bestandext == "gif") {
echo '<img src="' . $bestandsnaam . '">';
}
// Bestanden aangeven
if ($bestandext == "jpg" || $bestandext == "png" || $bestandext == "jpeg") {
$afbeelding = $dir . $bestandsnaam;
$afbeelding = str_replace(getcwd(), "", $afbeelding);
$afbeelding = ltrim($afbeelding, '\\');
echo '<img src="' . $afbeelding . '">';
}
if ($bestandext == "php" || $bestandext == "txt" || $bestandext == "css") {
示例14: parse_js_array
if (preg_match('/monthly_history = (.*?);/mis', $output, $matches, PREG_OFFSET_CAPTURE)) {
$monthly_results = parse_js_array($matches[1][0]);
}
// close curl resource to free up system resources
curl_close($ch);
echo "\${color #B8FF00}Monthly Bandwidth Usage\${color white}\n";
foreach (array_reverse($monthly_results) as $k => $result) {
if ($k >= 3) {
break;
}
if ($k == 0) {
echo '${font Bitstream Vera:size=10:style=Bold}';
} else {
echo '${font Bitstream Vera:size=10}';
}
$date = date("F", strtotime($result[0] . "+ 1 day"));
echo sprintf("%-25s \${alignr}%-12s \${alignr}%s\n", $date, formatSizeUnits($result[1]), formatSizeUnits($result[2]));
}
echo "\n\${color #B8FF00}Daily Bandwidth Usage\${color white}\n";
foreach (array_reverse($daily_results) as $k => $result) {
if ($k >= 3) {
break;
}
if ($k == 0) {
echo '${font Bitstream Vera:size=10:style=Bold}';
} else {
echo '${font Bitstream Vera:size=10}';
}
$date = date("F jS", strtotime($result[0]));
echo sprintf("%-25s \${alignr}%-12s \${alignr}%s\n", $date, formatSizeUnits($result[1]), formatSizeUnits($result[2]));
}
示例15: while
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
the_content();
}
}
?>
<div class="clearfix"></div>
<?php
$research_pdf = get_post_meta($post->ID, 'authors_section_pdf', true);
$pdf_id = get_pdf_id($research_pdf);
$file_path = filesize(get_attached_file($pdf_id));
$pdf_size = $file_path;
if (!empty($research_pdf)) {
echo '<a class="button float-right bottom-spacing" target="_blank" href="' . $research_pdf . '">View (PDF, ' . formatSizeUnits($pdf_size) . ')</a>';
}
?>
</div>
<!-- Research ends here-->
</div>
<?php
//sidebar comes here
get_sidebar();
?>
</div>
</div>
<?php
get_footer();
开发者ID:nationalarchives,项目名称:tna-child-about-us-research,代码行数:31,代码来源:research-repository-details.php