
En continuant le sujet de la console …
Le progrès-bar simple sur пхп … =)
<? class progressbar { private $escapeSequence = "\033 [%sm"; "\033[%sm"; private $text = "; ''; private $steps = 0; 0; private $delim = "; ''; private $step = 0; 0; private $maxchars = 70; 70; public function __ construct ($steps=100, $text = ", $ delim = ' # ', $ maxchars=70)$steps=100,$text='',$delim='#',$maxchars=70) { $this-> steps = abs ($steps); = abs($steps); $this-> step = 0; = 0; $this-> text = $text; = $text; $this-> delim = $delim; = $delim; $this-> maxchars = $maxchars; = $maxchars; $this-> draw ();(); } public function update ()) { $this-> step ++;++; $this-> redraw ();(); } private function draw ()) { print $this-> text. ' [';text.' ['; $proc = round (($this-> step / $ this-> steps) *100,0);(($this->step/$this->steps)*100,0); $complete = $proc. ' DU % complete ';.'% complete'; $isuse = strlen ($complete) + 4 + strlen ($this-> text);($complete) + 4 + strlen($this->text); $max = $this-> maxchars - $isuse;->maxchars - $isuse; $dash = round ($max * ($ proc/100) +1);($max*($proc/100)+1); $free = $max - $dash; - $dash; if ($dash> 0) print str_repeat ($this-> delim, $dash);>0) print str_repeat($this->delim,$dash); if ($free> 0) print str_repeat (' - ', $ free);>0) print str_repeat('-',$free); print '] '. $ complete;$complete; } private function redraw ()) { $this-> toPos ();(); $this-> draw ();(); } private function toPos ($column = 1) $column = 1 ) { echo "\033 [{$column} G";G"; } } ?>
Les références, où on peut айти cette classe :
phpclasses.org





CharnaD
13 Pont, 2008
Je tout voulais chez sur хостинге faire CLI l'application, mais on ne peut pas là ((
Alex Snet
14 Pont, 2008
CharnaD, je peux proposer.
ВПС, s'il faut …
0utPunk
17 Pont, 2008
Assez интесный la classe, voulait écrire il y a longtemps, oui n'a pas eu le temps) Dès qu'il sera utile, j'essaierai absolument.
Alex Snet
17 Pont, 2008
Je serai content, si aide =)
Si que, passez plus souvent. J'exposerai Bientôt сурцы comme travailler complexe les obscénités les comptes et cetera. =). =)