php 仿Comsenz安裝效果代碼打包提供下載
更新時(shí)間:2010年05月09日 10:25:58 作者:
一直都覺得Comsenz產(chǎn)品的數(shù)據(jù)表安裝效果很漂亮,今天抽了個(gè)空,把它的核心代碼都提煉出來了。
最終的效果如下:
/**
* step.inc.php 安裝步驟效果類 *
* 從Comsenz產(chǎn)品的數(shù)據(jù)表安裝效果中提取出主要代碼,以供大家學(xué)習(xí)
* @author tianxin
* @version 1.0.0 *
*/
class StepClass {
function show_header() {
define('SHOW_HEADER', TRUE);
$step = 1;
$version = 'beta1.0';
$release = '20100223';
$install_lang = '簡(jiǎn)體中文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" content="text/html; charset=$charset" />
<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) {
$('notice').value += message + "\\r\\n";
}
</script>
<meta content="Comsenz Inc." name="Copyright" />
</head>
<div class="container">
<div class="header">
<h1>$title</h1>
<span>$version $install_lang $release</span>
EOT;
$step > 0 && $this->show_step($step);
}
function show_step($step) {
$laststep = 4;
$title = '仿Comsenz安裝';
$comment = '正在執(zhí)行操作';
$stepclass = array();
for($i = 1; $i <= $laststep; $i++) {
$stepclass[$i] = $i == $step ? 'current' : ($i < $step ? '' : 'unactivated');
}
$stepclass[$laststep] .= ' last';
echo <<<EOT
<div class="setup step{$step}">
<h2>$title</h2>
<p>$comment</p>
</div>
<div class="stepstat">
<ul>
<li class="$stepclass[1]">1</li>
<li class="$stepclass[2]">2</li>
<li class="$stepclass[3]">3</li>
<li class="$stepclass[4]">4</li>
</ul>
<div class="stepstatbg stepstat1"></div>
</div>
</div>
<div class="main">
EOT;
}
function show_install() {
?>
<script type="text/javascript">
function showmessage(message) {
document.getElementById('notice').value += message + "\r\n";
}
function initinput() {
window.location='http://chabaoo.cn';
}
</script>
<div class="main">
<div class="btnbox"><textarea name="notice" style="width: 80%;" readonly="readonly" id="notice"></textarea></div>
<div class="btnbox marginbot">
<input type="button" name="submit" value="正在執(zhí)行……" disabled style="height: 25" id="laststep" onclick="initinput()">
</div>
<?php
}
function runquery() {
for($i=1;$i<=15;$i++)
{
$this->showjsmessage('執(zhí)行操作'.' '.$i.' ... '.'成功');
//模擬每執(zhí)行完一個(gè)動(dòng)作的延時(shí)
sleep(1);
}
}
function showjsmessage($message) {
echo '<script type="text/javascript">showmessage(\''.addslashes($message).' \');</script>'."\r\n";
flush();
ob_flush();
}
function show_footer($quit = true) {
echo <<<EOT
<div class="footer">©2001 - 2010 <a href="http://chabaoo.cn/">甜心</a> 瑤瑤說殺很大.</div>
</div>
</div>
</body>
</html>
EOT;
$quit && exit();
}
}
調(diào)用方法:
header('Content-Type: text/html; charset=utf-8');
include('step.inc.php');
$step=new StepClass();
//顯示頁面頭部
$step->show_header();
//顯示操作進(jìn)度
$step->show_install();
//運(yùn)行操作
$step->runquery();
echo '<script type="text/javascript">document.getElementById("laststep").disabled=false;document.getElementById("laststep").value = \'執(zhí)行完所有操作,進(jìn)入下一步\';</script>'."\r\n";
//顯示頁面尾部
$step->show_footer();
完整的demo:stepdemo.rar
step.inc.php 安裝步驟效果類:
復(fù)制代碼 代碼如下:
/**
* step.inc.php 安裝步驟效果類 *
* 從Comsenz產(chǎn)品的數(shù)據(jù)表安裝效果中提取出主要代碼,以供大家學(xué)習(xí)
* @author tianxin
* @version 1.0.0 *
*/
class StepClass {
function show_header() {
define('SHOW_HEADER', TRUE);
$step = 1;
$version = 'beta1.0';
$release = '20100223';
$install_lang = '簡(jiǎn)體中文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" content="text/html; charset=$charset" />
<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) {
$('notice').value += message + "\\r\\n";
}
</script>
<meta content="Comsenz Inc." name="Copyright" />
</head>
<div class="container">
<div class="header">
<h1>$title</h1>
<span>$version $install_lang $release</span>
EOT;
$step > 0 && $this->show_step($step);
}
function show_step($step) {
$laststep = 4;
$title = '仿Comsenz安裝';
$comment = '正在執(zhí)行操作';
$stepclass = array();
for($i = 1; $i <= $laststep; $i++) {
$stepclass[$i] = $i == $step ? 'current' : ($i < $step ? '' : 'unactivated');
}
$stepclass[$laststep] .= ' last';
echo <<<EOT
<div class="setup step{$step}">
<h2>$title</h2>
<p>$comment</p>
</div>
<div class="stepstat">
<ul>
<li class="$stepclass[1]">1</li>
<li class="$stepclass[2]">2</li>
<li class="$stepclass[3]">3</li>
<li class="$stepclass[4]">4</li>
</ul>
<div class="stepstatbg stepstat1"></div>
</div>
</div>
<div class="main">
EOT;
}
function show_install() {
?>
<script type="text/javascript">
function showmessage(message) {
document.getElementById('notice').value += message + "\r\n";
}
function initinput() {
window.location='http://chabaoo.cn';
}
</script>
<div class="main">
<div class="btnbox"><textarea name="notice" style="width: 80%;" readonly="readonly" id="notice"></textarea></div>
<div class="btnbox marginbot">
<input type="button" name="submit" value="正在執(zhí)行……" disabled style="height: 25" id="laststep" onclick="initinput()">
</div>
<?php
}
function runquery() {
for($i=1;$i<=15;$i++)
{
$this->showjsmessage('執(zhí)行操作'.' '.$i.' ... '.'成功');
//模擬每執(zhí)行完一個(gè)動(dòng)作的延時(shí)
sleep(1);
}
}
function showjsmessage($message) {
echo '<script type="text/javascript">showmessage(\''.addslashes($message).' \');</script>'."\r\n";
flush();
ob_flush();
}
function show_footer($quit = true) {
echo <<<EOT
<div class="footer">©2001 - 2010 <a href="http://chabaoo.cn/">甜心</a> 瑤瑤說殺很大.</div>
</div>
</div>
</body>
</html>
EOT;
$quit && exit();
}
}
調(diào)用方法:
復(fù)制代碼 代碼如下:
header('Content-Type: text/html; charset=utf-8');
include('step.inc.php');
$step=new StepClass();
//顯示頁面頭部
$step->show_header();
//顯示操作進(jìn)度
$step->show_install();
//運(yùn)行操作
$step->runquery();
echo '<script type="text/javascript">document.getElementById("laststep").disabled=false;document.getElementById("laststep").value = \'執(zhí)行完所有操作,進(jìn)入下一步\';</script>'."\r\n";
//顯示頁面尾部
$step->show_footer();
完整的demo:stepdemo.rar
您可能感興趣的文章:
- PHP/ThinkPHP實(shí)現(xiàn)批量打包下載文件的方法示例
- php在線打包程序源碼
- ThinkPHP實(shí)現(xiàn)將本地文件打包成zip下載
- php將文件夾打包成zip文件的簡(jiǎn)單實(shí)現(xiàn)方法
- PHP簡(jiǎn)單系統(tǒng)查詢模塊代碼打包下載
- 幾行代碼輕松實(shí)現(xiàn)PHP文件打包下載zip
- php打包網(wǎng)站并在線壓縮為zip
- PHP實(shí)現(xiàn)圖片批量打包下載功能
- php項(xiàng)目打包方法
- PHP在線打包下載功能示例
- php打包壓縮文件之ZipArchive方法用法分析
- PHP實(shí)現(xiàn)打包下載文件的方法示例
相關(guān)文章
thinkPHP通用控制器實(shí)現(xiàn)方法示例
這篇文章主要介紹了thinkPHP通用控制器實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了thinkPHP針對(duì)數(shù)據(jù)庫的基本CURD操作方法的封裝實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-11-11PHP+MYSQL實(shí)現(xiàn)讀寫分離簡(jiǎn)單實(shí)戰(zhàn)
本篇文章主要介紹了PHP+MYSQL實(shí)現(xiàn)讀寫分離,實(shí)例分析了讀寫分離的技巧,從而提高數(shù)據(jù)庫的負(fù)載能力,具有一定的參考價(jià)值,有興趣的可以了解一下。2017-03-03thinkphp路由規(guī)則使用示例詳解和偽靜態(tài)功能實(shí)現(xiàn)(apache重寫)
這篇文章主要介紹了thinkphp路由規(guī)則使用示例詳解和偽靜態(tài)功能實(shí)現(xiàn)(apache重寫),需要的朋友可以參考下2014-02-02詳解PHP使用日期時(shí)間處理器Carbon人性化顯示時(shí)間
本篇文章主要介紹了詳解PHP使用日期時(shí)間處理器Carbon人性化顯示時(shí)間,具有一定的參考價(jià)值,有興趣的可以了解一下2017-08-0864位windows系統(tǒng)下安裝Memcache緩存
這篇文章主要介紹了64位windows系統(tǒng)下安裝Memcache緩存的相關(guān)資料,需要的朋友可以參考下2015-12-12