|
Server IP : 127.0.0.1 / Your IP : 127.0.0.1 Web Server : Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3 System : Windows NT WIN-R7LTCC7BPLI 6.3 build 9200 (Windows Server 2012 R2 Datacenter Edition) i586 User : GerbangSIPAD ( 0) PHP Version : 5.6.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF Directory (0777) : C:/xampp8.1/php/docs/examples/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* Show a progress bar when parsing a directory from CLI
* Do not display any progress bar from other SAPI
*
* To run on Windows platform, do:
* (path to PHP cli)\php.exe -f (this script)
*
* PHP versions 4 and 5
*
* @category PHP
* @package PHP_CompatInfo
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: $Id: parseDir_withCustomProgressBar.php,v 1.4 2008/07/24 21:18:08 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @ignore
*/
require_once 'PHP/CompatInfo.php';
if (php_sapi_name() == 'cli') {
/*
Display a progress bar like this one:
[))))) ] 8% - 45/563 files
*/
$pbar = array('formatString' => '[%bar%] %percent% - %fraction% files',
'barfill' => ')',
'prefill' => ' ',
'options' => array('percent_precision' => 0));
$driverType = 'text';
$driverOptions = array('silent' => false, 'progress' => 'bar',
'progressbar' => $pbar);
} else {
$driverType = 'array';
$driverOptions = array();
}
$info = new PHP_CompatInfo($driverType, $driverOptions);
$dir = 'C:\php\pear\HTML_Progress2';
$r = $info->parseDir($dir);
/*
To keep backward compatibility, result is also return (here in $r)
but you don't need to print it, it's the default behavior of API 1.8.0
*/
//var_export($r);
?>