
Continuando el tema de la consola …
El progreso-bar simple en пхп … =)
¿<? 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. ' DEL % 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"; } } ?>
Las referencias, donde es posible айти esta clase:
phpclasses.org





CharnaD
13 Puente, 2008
Todo quería sobre el alojamiento hacer CLI la aplicación, а no es posible allí ((
Alex Snet
14 Puente, 2008
CharnaD, puedo proponer.
ВПС, si es necesario …
0utPunk
17 Puente, 2008
Bastante интесный la clase, hace mucho quería escribir, sí no ha llegado a tiempo) Tan pronto como es útil, probaré obligatoriamente.
Alex Snet
17 Puente, 2008
Seré contento, si ayuda =)
Si que, pasáis más a menudo. Pondré Pronto сурцы como tratar difícil el mate los cálculos etcétera. =). =)