本文整理汇总了PHP中HTML_Progress::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Progress::getValue方法的具体用法?PHP HTML_Progress::getValue怎么用?PHP HTML_Progress::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Progress
的用法示例。
在下文中一共展示了HTML_Progress::getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
require_once 'HTML/Progress.php';
$bar = new HTML_Progress();
$bar->setIncrement(5);
$bar->incValue();
printf('value after 1st update = %d <br/>', $bar->getValue());
$dm =& $bar->getDM();
$dm->incValue();
printf('value after 2nd update = %d <br/>', $dm->getValue());
示例2: while
do {
$bar->display();
$bar->sleep();
// for purpose of demo only
if ($bar->getPercentComplete() == 1) {
$loop++;
if ($bar->isIndeterminate()) {
$bar->setValue(0);
} else {
break;
// progress bar reached 100% in determinate mode
}
} else {
$bar->incValue();
}
/** rule to decide when to switch back to determinate mode
* - after two full loops and half one
*/
if ($bar->isIndeterminate()) {
if ($loop == 2 && $bar->getValue() == 50) {
$bar->setIndeterminate(false);
$bar->setString(null);
// display % string
$bar->setValue(0);
}
}
} while (1);
?>
</body>
</html>
示例3:
<?php
require_once 'HTML/Progress.php';
$bar = new HTML_Progress();
$bar->setValue(45);
printf('direct way: value = %d <br/>', $bar->getValue());
$dm =& $bar->getDM();
$dm->setValue(45);
printf('another way: value = %d <br/>', $dm->getValue());
示例4: array
</style>
<script type="text/javascript">
<!--
<?php
echo $bar->getScript();
?>
//-->
</script>
</head>
<body>
<?php
echo $bar->toHtml();
$pkg = array('PEAR', 'Archive_Tar', 'Config', 'HTML_QuickForm', 'HTML_CSS', 'HTML_Page', 'HTML_Template_Sigma', 'Log', 'MDB', 'PHPUnit');
do {
$val = $bar->getValue();
$i = floor($val / 10);
if ($val == 100) {
$msg = '';
} else {
$msg = " installing package ({$val} %) ... : ";
$msg .= $pkg[$i];
}
$bar->setString($msg);
$bar->display();
if ($bar->getPercentComplete() == 1) {
break;
// the progress bar has reached 100%
}
$bar->sleep();
// for purpose of demo only