listing-2.3.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 80 行
PHP
80 行
<?php
require_once 'HTML/Progress.php';
function myProgressHandler($progressValue, &$bar)
{
static $c;
if (!isset($c)) {
$c = 0;
}
$bar->sleep(); // wait 0.5 second
if ($bar->isIndeterminate()) {
if ($progressValue == 100) {
$c++;
echo "myProgressHandler -> loop #$c <br/>\n";
}
/* switch back from indeterminate to determinate mode
after 3 full loops */
*/
if ($c == 3) {
$bar->setIndeterminate(false);
$bar->setValue(0);
$bar->setString(null); // re-show percent info
}
}
}
$progress = new HTML_Progress();
$ui = & $progress->getUI();
$ui->setProgressAttributes(array(
'background-color' => '#e0e0e0'
));
$ui->setStringAttributes(array(
'color' => '#996',
'background-color' => '#CCCC99'
));
$ui->setCellAttributes(array(
'active-color' => '#996'
));
$progress->setAnimSpeed(500);
$progress->setIncrement(10);
$progress->setStringPainted(true); // get space for the string
$progress->setString(""); // but don't paint it
$progress->setIndeterminate(true); // Progress start in indeterminate mode
$progress->setProgressHandler('myProgressHandler');
?>
<html>
<head>
<title>Listing 2.3 </title>
<style type="text/css">
<!--
body {
background-color: #CCCC99;
color: #996;
font-family: Verdana, Arial;
}
<?php echo $progress->getStyle(); ?>
// -->
</style>
<script type="text/javascript">
<!--
<?php echo $progress->getScript(); ?>
//-->
</script>
</head>
<body>
<?php
echo $progress->toHtml();
$progress->run();
?>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?