Home  >  Article  >  Backend Development  >  PHP imitation Comsenz installation effect code

PHP imitation Comsenz installation effect code

PHPz
PHPzOriginal
2016-07-29 08:42:351696browse

最终的效果如下:php 仿Comsenz安装效果代码打包提供下载

step.inc.php 安装步骤效果类: 代码如下:

/**
* step.inc.php 安装步骤效果类 *
* 从Comsenz产品的数据表安装效果中提取出主要代码,以供大家学习
* @author tianxin
* @version 1.0.0 *
*/
class StepClass {
function show_header() {
define('SHOW_HEADER', TRUE);
$step = 1;
$version = 'beta1.0';
$release = '20100223';
$install_lang = '简体中文UTF8版';
$title = '仿Comsenz安装';
$charset = 'uft-8';
echo <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>$title</title>
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
<script type="text/javascript">
function $(id) {
return document.getElementById(id);
}
function showmessage(message) {
$(&#39;notice&#39;)。value += message + "\\r\\n";
}
</script>
<meta c name="Copyright" />
</head>
<div>
<div>
<h1>$title</h1>
<span>$version $install_lang $release</span>
EOT;
$step > 0 && $this->show_step($step);
}
function show_step($step) {
$laststep = 4;
$title = &#39;仿Comsenz安装&#39;;
$comment = &#39;正在执行操作&#39;;
$stepclass = array();
for($i = 1; $i <= $laststep; $i++) {
$stepclass[$i] = $i == $step ? &#39;current&#39; : ($i < $step ? &#39;&#39; : &#39;unactivated&#39;);
}
$stepclass[$laststep] .= &#39; last&#39;;
echo <<<EOT
<div>
<h2>$title</h2>
<p>$comment</p>
</div>
<div>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
<div></div>
</div>
</div>
<div>
EOT;
}
function show_install() {
?>
<script type="text/javascript">
function showmessage(message) {
document.getElementById(&#39;notice&#39;)。value += message + "\r\n";
}
function initinput() {
window.location=&#39;http://www.jb51.net&#39;;
}
</script>
<div>
<div><textarea name="notice" read></textarea></div>
<div>
<input type="button" name="submit" value="正在执行……" disabled >

 代码如下:

header(&#39;Content-Type: text/html; charset=utf-8&#39;);
include(&#39;step.inc.php&#39;);
$step=new StepClass();
//显示页面头部
$step->show_header();
//显示操作进度
$step->show_install();
//运行操作
$step->runquery();
echo &#39;<script type="text/javascript">document.getElementById("laststep")。
disabled=false;document.getElementById("laststep")。value = \&#39;执行完所有操作,进入下一步\&#39;;</script>&#39;."\r\n";
//显示页面尾部
$step->show_footer();
完整的demo:stepdemo.rar


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more