Top

[PHP] ÇÁ·Î±×·¹½º¹Ù(BAR) ¸¸µé±â! | Web-Programing
±è°æÈÆ (admin) | Editor | 2014/11/14 18:56:19 | Á¶È¸:6221

È­ºí¿¡´Â ȸ¿øµé¿¡°Ô ´Üü¸ÞÀÏÀ» Àü¼ÛÇÏ´Â ÆäÀÌÁö°¡ ÀÖ´Ù.

¹°·Ð, °ü¸®ÀÚ¸¸..


¸¹Àº ȸ¿øµé¿¡°Ô ¸ÞÀÏÀ» º¸³»´Ù º¸´Ï.. ¾î´ÀÁ¤µµ ÁøÇàµÇ°í ÀÖ´ÂÁö ¾Ë°í ½Í¾î °³¹ßÀ» Çß´Ù.



  1. //ÇÁ·Î±×·¹½º¹Ù¸¦ »ý¼ºÇØÁÖ´Â ÇÔ¼ö
  2. function create_status_bar()
  3. {
  4.      echo "
  5.         <style>
  6.             #text { position: absolute; top: 100px; left: 50%; margin: 0px 0px 0px -150px; font-size: 18px; text-align: center; width: 300px; }
  7.             #barbox_a { position: absolute; top: 130px; left: 50%; margin: 0px 0px 0px -160px; width: 304px; height: 24px; background-color: #bbbbbb; }
  8.             .text { position: absolute; top: 170px; left: 50%; margin: 0px 0px 0px -150px; font-size: 18px; text-align: center; width: 300px; background-color: #FFFFFF;}
  9.             .per { position: absolute; top: 130px; font-size: 18px; left: 50%; margin: 1px 0px 0px 150px; background-color: #FFFFFF; }
  10.             .bar { position: absolute; top: 132px; left: 50%; margin: 0px 0px 0px -158px; width: 0px; height: 20px; background-color: #dcdcdc; }
  11.             .blank { background-color: white; width: 300px; }
  12.         </style>";
  13.     echo "
  14.         <div id='text'>¸ÞÀÏ Àü¼ÛÁß.</div>
  15.         <div id='barbox_a'></div>
  16.         <div class='bar blank'></div>
  17.         <div class='per'>0%</div>
  18.         ";
  19.         flush();
  20. }       
  21. //ÇÁ·Î±×·¹½º »óŸ¦ ¾÷µ¥ÀÌÆ® ÇØÁÖ´Â ÇÔ¼ö. 
  22. //¸Å°³º¯¼ö°ªÀº º»ÀÎÀÌ ¿øÇϴµ¥·Î ¼öÁ¤ÇÏ¸é µÈ´Ù.
  23. function update_status_bar($percent, $mem_c, $mem_n)
  24. {
  25.     echo "<div class='per'>{$percent}%</div>n";
  26.     echo "<div class='bar' style='width: ", $percent * 3, "px'></div>n";
  27.     echo "<div class='text'>{$mem_n} / {$mem_c} </div>";
  28.     flush();
  29. }
  30. // ÇÁ·Î±×·¹½º¹Ù Ãâ·Â!
  31. create_status_bar();
  32. $count = 10;
  33. for($i=0 ; $i < $count ; $i++)
  34. {
  35.     send_mail_to_person($conntents);
  36.     sleep(1);
  37.     $percent_value = round((100/($count-1))*$i);
  38.     update_status_bar($percent_value, $count, $i+1);
  39. }


±×³É °¡Á®´Ù ½áµµ µÇÁö¸¸

Àý¶§ ¾î·Á¿î ¼Ò½º ¾Æ´Ï´Ï

±×³É °¡Á®´Ù º»ÀÎÀÇ ÆäÀÌÁö¿¡ ¸Â°Ô ¼öÁ¤ Çؼ­ ¾²¸é ÁÁÀ»°Í °°´Ù.





°øÀ¯Çϱâ
°øÀ¯Çϱâ
1
0
0


´ñ±ÛÀ» ºÒ·¯¿À´Â ÁßÀÔ´Ï´Ù.
¡ã ÀÌÀü±Û [MYSQL] À̹ÌÁö,ÆÄÀÏ ¾÷·Îµå Çϱ⠾ÈÁöÈì (hoomiyam) 2014-12-26 10:17:32
¡å ´ÙÀ½±Û [SVN] SVN ¸í·É¾î ±è°æÈÆ (admin) 2014-11-14 16:36:43