• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fileSize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fileSize函数的典型用法代码示例。如果您正苦于以下问题:PHP fileSize函数的具体用法?PHP fileSize怎么用?PHP fileSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fileSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: conv_ringtone

 function conv_ringtone($infile, $outbase)
 {
     /*
     $outfile = $outbase .'.wav';
     */
     $outfile = $outbase . '.mp3';
     if (strToLower(subStr($infile, -4, 4)) === '.mp3') {
         if (fileSize($infile) <= 1000000) {
             # 1 MB
             if (!@copy($infile, $outfile)) {
                 return false;
             }
             return $outfile;
         }
     }
     /*
     if     (is_executable( '/usr/local/bin/mpg123' ))
     	$mpg123 = '/usr/local/bin/mpg123';
     elseif (is_executable( '/usr/bin/mpg123' ))
     	$mpg123 = '/usr/bin/mpg123';
     elseif (is_executable( '/bin/mpg123' ))
     	$mpg123 = '/bin/mpg123';
     else
     	$mpg123 = 'mpg123';
     
     if (strToLower(subStr($infile, -4, 4)) === '.mp3') {
     	# convert mp3 to wav first
     	$wavfile = $infile .'.wav';
     	$cmd = $mpg123 .' -m -w - -n 1000 -q '. qsa($infile) .' > '. qsa($wavfile) .' 2>>/dev/null';
     	# cuts file after 1000 frames (around 2.3 MB, depending on the rate)
     	# don't use -r 8000 as that doesn't really work for VBR encoded MP3s
     	@exec($cmd, $out, $err);
     	if ($err != 0) {
     		if (is_file($wavfile)) @unlink( $wavfile );
     		return false;
     	}
     	$infile = $wavfile;
     	$rm_tmp = $wavfile;
     } else
     	$rm_tmp = false;
     
     $cmd = 'sox '. qsa($infile) .' -r 8000 -c 1 -w '. qsa($outfile) .' trim 0 125000s 2>>/dev/null';
     # WAV, PCM, 8 kHz, 16 bit, mono
     # "The time for loading the file should not be longer then 3 seconds.
     # Size < 250 KByte."
     # cuts file after 125000 samples (around 245 kB, 15 secs)
     @exec($cmd, $out, $err);
     if ($err != 0) {
     	# $err == 2 would be unknown format
     	if (is_file($outfile)) @unlink( $outfile );
     	if ($rm_tmp && is_file($rm_tmp)) @unlink($rm_tmp);
     	return false;
     }
     return $outfile;
     */
     //return false;
     return null;
     # not implemented
 }
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:59,代码来源:capability.php


示例2: drawScores

function drawScores()
{
    $scoresFile = fopen("highscores.txt", "r") or die("Unable to open file!");
    $lines = explode("\n", fread($scoresFile, fileSize("highscores.txt")));
    fclose($scoresFile);
    echo "<ol style='color:white;'>";
    foreach ($lines as $line) {
        echo "<li>";
        echo $line;
        echo "</li>";
    }
    echo "</ol>";
}
开发者ID:jdsutton,项目名称:BlackDragonProductions,代码行数:13,代码来源:highscores.php


示例3: uploadCreate

 private function uploadCreate($file_name)
 {
     $fileSize = fileSize($file_name);
     $url = 'http://' . $this->upload_server_ip . '/gupload/create_file';
     $param = array('upload_token' => $this->upload_token, 'file_size' => $fileSize, 'slice_length' => 1024, 'ext' => $this->getFileExt($file_name));
     try {
         $result = json_decode(Http::post($url, $param));
         if (isset($result->error)) {
             $error = $result->error;
             throw new UploadException($error->description, $error->code);
         }
     } catch (UploadException $e) {
         echo $e->getError();
         exit;
     }
     return $result;
 }
开发者ID:newlifes01,项目名称:youkuupload-php-sdk,代码行数:17,代码来源:YoukuUploader.class.php


示例4: addScore

function addScore($score, $name)
{
    $maxScores = 10;
    // Open the scores file for reading
    $scoresFile = fopen("highscores.txt", "r") or die("Unable to open file!");
    // Read in the scores
    $lines = explode("\n", fread($scoresFile, fileSize("highscores.txt")));
    // Close the file
    fclose($scoresFile);
    // Sort the scores
    $scores = array($name => intval($score));
    //array_push($scores, intval($score));
    foreach ($lines as $line) {
        $data = explode(" ", $line);
        $name = $data[0];
        $score = intval($data[1]);
        if (empty($scores[$name]) || $score > $scores[$name]) {
            $scores[$name] = $score;
        }
    }
    arsort($scores);
    // Remove excess scores
    while (count($scores) > $maxScores) {
        array_pop($scores);
    }
    // Open the scores file for reading
    $scoresFile = fopen("highscores.txt", "w") or die("Unable to open file!");
    // Write the scores
    $i;
    $len = count($scores);
    foreach ($scores as $name => $score) {
        fwrite($scoresFile, $name . " " . strval($score));
        if ($i < $len - 1) {
            fwrite($scoresFile, "\n");
        }
        $i += 1;
    }
    // Close the file
    fclose($scoresFile);
}
开发者ID:jdsutton,项目名称:HighscoreBoard,代码行数:40,代码来源:addScore.php


示例5: __construct

 public function __construct($path, $name = null)
 {
     // Make sure error logs are ready.
     if ($this->logging === TRUE) {
         $this->prepareLogs();
     }
     // See what kind of file we should be working with
     // If path is simply a pointer to directory we will look to create a new file with name
     // Otherwise if it is pointing to file, let's open that file.
     if (is_dir($path) && $name) {
         // Create a file with that name in this path
         $this->file = fopen($path . $name, 'w');
         $this->path = $path . $name;
     } else {
         if (is_file($path) && is_writable($path)) {
             // Then let's go ahead and read it.
             $this->file = fopen($path, 'a+');
             $this->path = $path;
         }
     }
     // If by this point no file is set, error out.
     if (!$this->file) {
         return $this->processError($this->error[100]);
         die;
     }
     // Set some member variables.
     $this->isOpen = TRUE;
     $this->fileSize = fileSize($path) . ' bytes';
     $this->type = substr(strrchr($path, '.'), 1);
     $this->contentString = file_get_contents($path);
 }
开发者ID:schneidermankyle,项目名称:file.IO,代码行数:31,代码来源:file.class.php


示例6: getSize

function getSize($a)
{
    if (file_exists($a)) {
        return fileSize($a);
    }
}
开发者ID:jyyy410team,项目名称:hts,代码行数:6,代码来源:loaddir-old.php


示例7: downloadFile

 /**
  * Download file
  *
  * @param int $id
  *
  * @return Response
  */
 public function downloadFile($id)
 {
     $file = FmFile::where('status', Constants::$COMMON_STATUSES['public'])->find($id);
     if (empty($file)) {
         App::abort('404');
     }
     $filePath = Utilities::getFileUploadPath() . $file->name;
     $content = file_get_contents($filePath);
     $contentLength = fileSize($filePath);
     $headers = array('Content-Length' => $contentLength, 'Content-disposition' => 'attachment; filename=' . $file->original_name);
     $finfo = new \finfo(FILEINFO_MIME_TYPE);
     $contentType = $finfo->buffer($content);
     if ($contentType == 'audio/mpeg') {
         $headers['Content-Type'] = 'application/octet-stream';
     }
     $response = Response::make($content);
     foreach ($headers as $headerName => $headerValue) {
         $response->header($headerName, $headerValue);
     }
     return $response;
 }
开发者ID:hungdo89,项目名称:file-manager,代码行数:28,代码来源:FrontendController.php


示例8: file

<!DOCTYPE html>
<html>
<head>
    <title>Course list</title>
    <meta charset="utf-8" />
    <link href="courses.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="header">
    <h1>Courses at CSE</h1>
<!-- Ex. 1: File of Courses -->
    <p>
    <?php 
$courses = file("courses.tsv");
$fileSize = fileSize("courses.tsv");
?>
        Course list has <?php 
echo count($courses);
?>
 total courses
        and
        size of <?php 
echo $fileSize;
?>
 bytes.
    </p>
</div>
<div class="article">
    <div class="section">
        <h2>Today's Courses</h2>
<!-- Ex. 2: Today’s Courses & Ex 6: Query Parameters -->
开发者ID:heojae91,项目名称:webLab00,代码行数:31,代码来源:courses.php


示例9: fopen

<?php

echo "Hold on, opening files...\n";
$fh = fopen("version.txt", "r");
$version = fread($fh, fileSize("version.txt"));
fclose($fh);
echo "Calculating stuffs...";
$version = $version++;
echo "You are committing version r{$version}.";
$fh = fopen("version.txt", "w");
fwrite($fh, $version);
fclose($fh);
// loop through each element in the $argv array
$i = 0;
foreach ($argv as $value) {
    if (!$i == 0) {
        $commitdata = $commitdata . $value;
    }
    $i++;
}
system("git commit -a -m 'r{$version} - {$commitdata}'");
echo "Done! Run git push to see it on GitHub.";
开发者ID:TDLive,项目名称:pre2013,代码行数:22,代码来源:commit.php


示例10: sleep

        return;
    }
    sleep(4);
    clearStatCache();
}
# download in progress?
#
if (file_exists('/tmp/gpbx-downloading-upgrade.pid') || (int) @shell_exec('sudo ps ax 2>>/dev/null | grep gpbx-upgrade-download | grep -v grep | wc -l') > 0) {
    echo '<br /><p>', 'Momentan wird ein Upgrade heruntergeladen.', '</p>', "\n";
    $upgrade_info = @gs_file_get_contents($gpbx_userdata . 'upgrades/upgrade-info');
    //$upgrade_info = ' gpbx_upgrade_size = 250420000 ';
    if (preg_match('/^\\s*gpbx_upgrade_size\\s*=\\s*([^\\s]*)/m', $upgrade_info, $m)) {
        $upgrade_size = (int) _upgrade_info_decode_val($m[1]);
        if ($upgrade_size > 50) {
            if (file_exists($gpbx_userdata . 'upgrades/dl/download')) {
                $download_size = @fileSize($gpbx_userdata . 'upgrades/dl/download');
                //$download_size = 210420000;
                if ($download_size !== false) {
                    echo '<p>', 'Fortschritt', ': &nbsp; <b>', number_format($download_size / $upgrade_size * 100, 1, ',', ''), ' %</b>';
                    if ($upgrade_size > 1000000) {
                        $factor = 1000000;
                        $units = 'MB';
                    } elseif ($upgrade_size > 1000) {
                        $factor = 1000;
                        $units = 'kB';
                    } else {
                        $factor = 1;
                        $units = 'B';
                    }
                    echo ' &nbsp; (', round($download_size / $factor), ' / ', round($upgrade_size / $factor), ' ', $units, ')</p>', "\n";
                    echo '<pre>';
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:system_gpbx-upgrade.php


示例11: fopen

<html>
    <head>
        <title>Candace's Phonebook</title>
        <link href="css/bootstrap.min.css"
              rel="stylesheet"
              type="text/css" />
        <link href="css/indexStylesheet.css"
              rel="stylesheet"
              type="text/css" />
    </head>
    <body>
        <div id="contactList" class="container">
            <?php 
//This will generate the list of phonebook entries on this page
$phonesFile = fopen("phones.dat", "r") or die("Unable to open file");
if (fileSize("phones.dat") > 0) {
    $allEntries = fread($phonesFile, filesize("phones.dat"));
    $entries = explode("\r\n", $allEntries);
    foreach ($entries as $entry) {
        if ($entry != $entries[count($entries) - 1]) {
            echo '<a href="' . "update.php?entry={$entry}" . '">' . $entry . '</a> (<a href="' . "delete.php?entry={$entry}" . '">x</a>)<br />';
        }
    }
} else {
    $allEntries = "No entries";
    echo $allEntries . "\r\n";
}
?>

            <br /><button id="addButton">Add a Phone Number</button>
        </div>
开发者ID:Candace-Williford,项目名称:ProjectsFromSchool,代码行数:31,代码来源:index.php


示例12: Test_of_binary_data_on_database

 public function Test_of_binary_data_on_database()
 {
     $ar_path = AK_FRAMEWORK_DIR . DS . 'active_record' . DS . 'base.php';
     $long_string = file_get_contents($ar_path);
     $_tmp_file = fopen($ar_path, "rb");
     $binary_data = fread($_tmp_file, fileSize($ar_path));
     $i = 1;
     $details = array('varchar_field' => "{$i} string ", 'longtext_field' => $long_string, 'text_field' => "{$i} text", 'logblob_field' => $binary_data, 'date_field' => "2005/05/{$i}", 'datetime_field' => "2005/05/{$i}", 'tinyint_field' => $i, 'integer_field' => $i, 'smallint_field' => $i, 'bigint_field' => $i, 'double_field' => "{$i}.{$i}", 'numeric_field' => $i, 'bytea_field' => $binary_data, 'timestamp_field' => "2005/05/{$i} {$i}:{$i}:{$i}", 'boolean_field' => !($i % 2), 'int2_field' => "{$i}", 'int4_field' => $i, 'int8_field' => $i, 'foat_field' => "{$i}.{$i}", 'varchar4000_field' => "{$i} text", 'clob_field' => "{$i} text", 'nvarchar2000_field' => "{$i} text", 'blob_field' => $binary_data, 'nvarchar_field' => "{$i}", 'decimal1_field' => "{$i}", 'decimal3_field' => $i, 'decimal5_field' => $i, 'decimal10_field' => "{$i}", 'decimal20_field' => $i, 'decimal_field' => $i);
     $AkTestField = new AkTestField($details);
     $this->assertEqual($long_string, $binary_data);
     $this->assertTrue($AkTestField->save());
     $AkTestField = new AkTestField($AkTestField->getId());
     $this->assertEqual($AkTestField->longtext_field, $long_string);
     $this->assertEqual($AkTestField->bytea_field, $binary_data);
     $this->assertEqual($AkTestField->blob_field, $binary_data);
     $this->assertEqual($AkTestField->logblob_field, $binary_data);
 }
开发者ID:bermi,项目名称:akelos,代码行数:17,代码来源:legacy_tests_3.php


示例13: isVaild

   	private function isVaild($file ,$validate)
	{
		
		if($validate === []) return true ; 
		if(array_key_exists("isVaildSize" , $validate))
		{
			$size = strtolower($validate["isVaildSize"]);
			$sizes = [
				"b"=> 1,
				"kb" => 1024 ,
				"mb" => 1024*1024 ,
				"gb" => 1024*1024*1024,
				"tb" => 1024*1024*1024*1024,
			];
			
			if(preg_match("/kb|mb|gb|tb|byte/" , $validate["isVaildSize"] , $output))
			{
				if(preg_match("/[\>\<\:\=]{1,2}/" ,$validate["isVaildSize"] , $x))
				{
					$validate["isVaildSize"] = str_replace($x[0] , "" , $validate["isVaildSize"]) ;
				}
				$size = (int) str_replace($output[0] , "" ,$validate["isVaildSize"]) ;
				$size*=$sizes[$output[0]] ;
				if(!$this->isVaildRange(fileSize($file) , $x[0].$size))
				{
					$this->latestValidateError = "inVaildSize" ;
					return false ; 
				}
			}
		} 
		
		if(in_array("isVaildImage" , $validate) || array_key_exists("isVaildDim" , $validate))
		{
			if($d = getimagesize($file))
			{
				if(array_key_exists("isVaildDim" , $validate))
				{
					$dims = explode("x" , strtolower($validate["isVaildDim"]));
					if(isset($dims[0]))
					{
						if(!$this->isVaildRange($d[0] , $dims[0]))
						{
							$this->latestValidateError = "notVaildWidth" ;
							return false ; 
						}
					}
					if(isset($dims[1]))
					{
						if(!$this->isVaildRange($d[1] , $dims[1]))
						{
							$this->latestValidateError = "notVaildHeight" ;
							return false ; 
						}
					}
					
				}
			}
			else
			{
				
				$this->latestValidateError = "notVaildImage" ;
				return false ;
				
			}
			
		}
		return true ; 
	}
开发者ID:ahmadmarafa,项目名称:Snippets,代码行数:68,代码来源:uploader.php


示例14: imagecreatefromblp

function imagecreatefromblp($fileName, $imgId = 0)
{
    if (!CLISetup::fileExists($fileName)) {
        CLISetup::log('file ' . $fileName . ' could not be found', CLISetup::LOG_ERROR);
        return;
    }
    $file = fopen($fileName, 'rb');
    if (!$file) {
        CLISetup::log('could not open file ' . $fileName, CLISetup::LOG_ERROR);
        return;
    }
    $fileSize = fileSize($fileName);
    if ($fileSize < 16) {
        CLISetup::log('file ' . $fileName . ' is too small for a BLP file', CLISetup::LOG_ERROR);
        return;
    }
    $data = fread($file, $fileSize);
    fclose($file);
    // predict replacement patch files
    // ref: http://www.zezula.net/en/mpq/patchfiles.html
    if (substr($data, 0x0, 0x4) == "PTCH") {
        // strip patch header
        if (substr($data, 0x40, 0x43) == "COPY") {
            $data = substr($data, 0x44);
        } else {
            CLISetup::log('file ' . $fileName . ' is an incremental patch file and cannot be used by this script.', CLISetup::LOG_ERROR);
            return;
        }
    }
    if (substr($data, 0, 4) != "BLP2") {
        CLISetup::log('file ' . $fileName . ' has incorrect/unsupported magic bytes', CLISetup::LOG_ERROR);
        return;
    }
    $header = unpack("Vformat/Ctype/CalphaBits/CalphaType/Cmips/Vwidth/Vheight", substr($data, 4, 16));
    $header['mipsOffs'] = unpack("V16", substr($data, 20, 64));
    $header['mipsSize'] = unpack("V16", substr($data, 84, 64));
    $debugStr = ' header = ' . print_r($header, true);
    if ($header['format'] != 1) {
        CLISetup::log('file ' . $fileName . ' has unsupported format' . $debugStr, CLISetup::LOG_ERROR);
        return;
    }
    $offs = $header['mipsOffs'][$imgId + 1];
    $size = $header['mipsSize'][$imgId + 1];
    while ($imgId > 0) {
        $header['width'] /= 2;
        $header['height'] /= 2;
        $imgId--;
    }
    if ($size == 0) {
        CLISetup::log('file ' . $fileName . ' contains zeroes in a mips table' . $debugStr, CLISetup::LOG_ERROR);
        return;
    }
    if ($offs + $size > $fileSize) {
        CLISetup::log('file ' . $fileName . ' is corrupted/incomplete' . $debugStr, CLISetup::LOG_ERROR);
        return;
    }
    if ($header['type'] == 1) {
        $img = icfb1($header['width'], $header['height'], substr($data, 148, 1024), substr($data, $offs, $size));
    } else {
        if ($header['type'] == 2) {
            $img = icfb2($header['width'], $header['height'], substr($data, $offs, $size), $header['alphaBits'], $header['alphaType']);
        } else {
            if ($header['type'] == 3) {
                $img = icfb3($header['width'], $header['height'], substr($data, $offs, $size));
            } else {
                CLISetup::log('file ' . $fileName . ' has unsupported type' . $debugStr, CLISetup::LOG_ERROR);
                return;
            }
        }
    }
    return $img;
}
开发者ID:saqar,项目名称:aowow,代码行数:72,代码来源:imagecreatefromblp.func.php


示例15: tAdventure


//.........这里部分代码省略.........
            }
        }
    }
    $cmd = cmd();
    if (!@isset($cmd) || $cmd == "") {
        tadventure($start, $pts, $items, true, $name);
    } elseif ($cmd == 'quit') {
        if (file_exists(".shocked.tmp")) {
            unlink(".shocked.tmp");
        }
        if (file_exists(".torch.tmp")) {
            unlink(".torch.tmp");
        }
        echo "Thanks for playing!\n";
        exit;
    } elseif ($cmd == 'save') {
        echo "Saving...\n";
        $fh = fopen("tadventure_save.txt", 'w') or tAdventure($start, $pts, $items, true, $name);
        fwrite($fh, "{$start}/{$pts}");
        foreach ($items as $value) {
            fwrite($fh, "/{$value}");
        }
        echo "Game saved!\n";
        tAdventure($start, $pts, $items, true, $name);
    } elseif ($cmd == "update") {
        system("wget --version > /dev/null", $wgetv);
        if (!$wgetv == 0) {
            echo "Error! wget is not installed!\n";
            tAdventure($start, $pts, $items, true);
        }
        echo "Checking the version...\n";
        system("wget -q https://raw.github.com/TDLive/tAdventure/master/version.txt -O version.txt");
        $fh = fopen("version.txt", "r");
        $version = fread($fh, fileSize("version.txt"));
        fclose($fh);
        if ($version == VERSION || $version < VERSION) {
            echo "Your version is too new/the latest!\n";
            tAdventure($start, $pts, $items, true, $name);
        } else {
            echo "Getting tAdventure...\n";
            system("wget -q https://raw.github.com/TDLive/tAdventure/master/adventure.php -O adventure.php");
            echo "Starting tAdventure...\n\n";
            system("php adventure.php", $exitcode);
            exit($exitcode);
        }
    } elseif ($cmd == "room") {
        echo "\n";
        tAdventure($start, $pts, $items);
    } elseif ($cmd == "left") {
        if ($rdat["connectsLeft"]) {
            foreach ($darkrooms as $value) {
                if ($rdat["connectsLeftId"] == $value) {
                    if (!file_exists(".torch.tmp")) {
                        echo "It's too dark to go down this way!\n";
                        tAdventure($start, $pts, $items, true, $name);
                    }
                }
            }
            tAdventure($rdat["connectsLeftId"], $pts, $items, false, $name);
        } else {
            echo "You can't go left.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "right") {
        if ($rdat["connectsRight"]) {
            foreach ($darkrooms as $value) {
开发者ID:TDLive,项目名称:pre2013,代码行数:67,代码来源:adventure.php


示例16: realPath

$raw_file = realPath('/tmp/' . $file);
if (empty($raw_file) || subStr($raw_file, 0, 5) !== '/tmp/') {
    header('HTTP/1.0 500 Internal Server Error', true, 500);
    header('Status: 500 Internal Server Error', true, 500);
    header('Content-Type: text/plain');
    die('Error. Bad filename.');
}
if ($raw) {
    # TIFF
    header('Content-Type: image/tiff');
    header('Content-Disposition: attachment; filename="' . $file . '"');
    header('Content-Length: ' . (int) @fileSize('/tmp/' . $file));
    @readFile('/tmp/' . $file);
    @unlink('/tmp/' . $file);
} else {
    #PDF
    $pdf_file = basename($file, '.tif') . '.pdf';
    @system('cd /var/spool/hylafax/ && /var/spool/hylafax/bin/tiff2pdf -o ' . qsa('/tmp/' . $pdf_file) . ' ' . qsa('/tmp/' . $file));
    unlink('/tmp/' . $file);
    if (!file_exists('/tmp/' . $pdf_file)) {
        header('HTTP/1.0 500 Internal Server Error', true, 500);
        header('Status: 500 Internal Server Error', true, 500);
        header('Content-Type: text/plain');
        die('Error. Failed to convert fax to PDF.');
    }
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename="' . $pdf_file . '"');
    header('Content-Length: ' . (int) @fileSize('/tmp/' . $pdf_file));
    @readFile('/tmp/' . $pdf_file);
    @unlink('/tmp/' . $pdf_file);
}
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:faxdown.php


示例17: elseif

    return;
}
if (file_exists('/var/lib/dhcp3/dhcpd.leases')) {
    # Debian 4
    $leases_file = '/var/lib/dhcp3/dhcpd.leases';
} elseif (file_exists('/var/lib/dhcp/dhcpd.leases')) {
    # Debian 5?
    $leases_file = '/var/lib/dhcp/dhcpd.leases';
} elseif (file_exists('/var/lib/dhcpd/dhcpd.leases')) {
    # RedHat
    $leases_file = '/var/lib/dhcpd/dhcpd.leases';
} else {
    echo 'dhcpd.leases not found.';
    return;
}
if (@fileSize($leases_file) > 1000000) {
    # around 4000 leases
    echo 'Leases file too large to read.';
    return;
}
function un_octal_escape($str)
{
    return preg_replace_callback('/\\\\([0-7]{1,3})/S', create_function('$m', 'return chr(octDec($m[1]));'), $str);
}
function binary_to_hex($str)
{
    $ret = '';
    $c = strLen($str);
    for ($i = 0; $i < $c; ++$i) {
        if ($i !== 0) {
            $ret .= '-';
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:system_dhcp-leases.php


示例18: Test_of_binary_data_on_database

 function Test_of_binary_data_on_database()
 {
     $long_string = file_get_contents(AK_LIB_DIR . DS . 'AkActiveRecord.php');
     $_tmp_file = fopen(AK_LIB_DIR . DS . 'AkActiveRecord.php', "rb");
     $binary_data = fread($_tmp_file, fileSize(AK_LIB_DIR . DS . 'AkActiveRecord.php'));
     $i = 1;
     $details = array('varchar_field' => "{$i} string ", 'longtext_field' => $long_string, 'text_field' => "{$i} text", 'logblob_field' => $binary_data, 'date_field' => "2005/05/{$i}", 'datetime_field' => "2005/05/{$i}", 'tinyint_field' => $i, 'integer_field' => $i, 'smallint_field' => $i, 'bigint_field' => $i, 'double_field' => "{$i}.{$i}", 'numeric_field' => $i, 'bytea_field' => $binary_data, 'timestamp_field' => "2005/05/{$i} {$i}:{$i}:{$i}", 'boolean_field' => !($i % 2), 'int2_field' => "{$i}", 'int4_field' => $i, 'int8_field' => $i, 'foat_field' => "{$i}.{$i}", 'varchar4000_field' => "{$i} text", 'clob_field' => "{$i} text", 'nvarchar2000_field' => "{$i} text", 'blob_field' => $binary_data, 'nvarchar_field' => "{$i}", 'decimal1_field' => "{$i}", 'decimal3_field' => $i, 'decimal5_field' => $i, 'decimal10_field' => "{$i}", 'decimal20_field' => $i, 'decimal_field' => $i);
     $AkTestField = new AkTestField($details);
     $this->assertEqual($long_string, $binary_data);
     $this->assertTrue($AkTestField->save());
     $AkTestField = new AkTestField($AkTestField->getId());
     $this->assertEqual($AkTestField->longtext_field, $long_string);
     $this->assertEqual($AkTestField->bytea_field, $binary_data);
     $this->assertEqual($AkTestField->blob_field, $binary_data);
     $this->assertEqual($AkTestField->logblob_field, $binary_data);
     //Now we add some more records for next tests
     foreach (range(2, 10) as $i) {
         $details = array('varchar_field' => "{$i} string", 'text_field' => "{$i} text", 'date_field' => "2005/05/{$i}", 'datetime_field' => "2005/05/{$i}", 'tinyint_field' => $i, 'integer_field' => $i, 'smallint_field' => $i, 'bigint_field' => $i, 'double_field' => "{$i}.{$i}", 'numeric_field' => $i, 'timestamp_field' => "2005/05/{$i} {$i}:{$i}:{$i}", 'boolean_field' => !($i % 2), 'int2_field' => "{$i}", 'int4_field' => $i, 'int8_field' => $i, 'foat_field' => "{$i}.{$i}", 'varchar4000_field' => "{$i} text", 'clob_field' => "{$i} text", 'nvarchar2000_field' => "{$i} text", 'nvarchar_field' => "{$i}", 'decimal3_field' => $i, 'decimal5_field' => $i, 'decimal10_field' => "{$i}", 'decimal20_field' => $i, 'decimal_field' => $i);
         $AkTestField = new AkTestField($details);
         $this->assertTrue($AkTestField->save());
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:22,代码来源:_AkActiveRecord_3.php


示例19: getSize

 function getSize($lpszFileName, &$width, &$height)
 {
     if (!($fh = @fOpen($lpszFileName, "rb"))) {
         return false;
     }
     $data = @fRead($fh, @fileSize($lpszFileName));
     @fClose($fh);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:8,代码来源:gif.php


示例20: readDataFile

function readDataFile($data_file)
{
    global $node;
    $datafilep = @fOpen($data_file, 'rb');
    if (!$datafilep) {
        write_log("Cannot open {$data_file} for reading! Using cluster data from configuration. This will reset *all* states!");
        return 1;
    }
    $datafilesize = fileSize($data_file);
    $save_struct = @fRead($datafilep, $datafilesize);
    $node = unSerialize($save_struct);
    fClose($datafilep);
}
开发者ID:rkania,项目名称:GS3,代码行数:13,代码来源:gs-cluster-watchdog.php



注:本文中的fileSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fileWrite函数代码示例发布时间:2022-05-15
下一篇:
PHP fileRead函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap