<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear.m.$thismonth; ?>')">
<td width="35"><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.m.$thismonth.t; ?>"></td>
<td><?php echo $thismonth; ?>月</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear.m.$thismonth; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> </td>
<td width="34"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>1日</td>
</tr>
<tr>
<td> </td>
<td><img src="images/turn.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>10日</td>
</tr>
</table>
<?php
}
}while($row_month = mysql_fetch_assoc($month));
}
?>
</td>
</tr>
</table>
<?php
$numy++;}else{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear; ?>')">
<td><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.t; ?>"><?php echo $thisyear; ?>年</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> </td>
<td>
<?php
if($totalRows_month>0){
do{
$thismonth=substr($row_month['datetime'],5,2);
if($totalRows_month>$numm){
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear.m.$thismonth; ?>')">
<td width="35"><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.m.$thismonth.t; ?>"></td>
<td><?php echo $thismonth; ?>月</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear.m.$thismonth; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="51"><img src="images/line.gif" width="16" height="17"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>1日</td>
</tr>
<tr>
<td><img src="images/line.gif" width="16" height="17"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>2日</td>
</tr>
<tr>
<td><img src="images/line.gif" width="16" height="17"><img src="images/turn.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>10日</td>
</tr>
</table>
<?php $numm++;}else{ ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear.m.$thismonth; ?>')">
<td width="35"><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.m.$thismonth.t; ?>"></td>
<td><?php echo $thismonth; ?>月</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear.m.$thismonth; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> </td>
<td width="34"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>1日</td>
</tr>
<tr>
<td> </td>
<td><img src="images/turn.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>10日</td>
</tr>
</table>
<?php
}
}while($row_month = mysql_fetch_assoc($month));
}
?>
</td>
</tr>
</table>
<?php }?>
<?php } // Show if recordset not empty ?>
<?php } while ($row_year = mysql_fetch_assoc($year)); ?></td>
</tr>
</table>
<?php
mysql_free_result($year);mysql_free_result($month);
?>
<tr onclick="thisdisplay('<?php echo y.$thisyear.m.$thismonth; ?>')">
<td width="35"><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.m.$thismonth.t; ?>"></td>
<td><?php echo $thismonth; ?>月</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear.m.$thismonth; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> </td>
<td width="34"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>1日</td>
</tr>
<tr>
<td> </td>
<td><img src="images/turn.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>10日</td>
</tr>
</table>
<?php
}
}while($row_month = mysql_fetch_assoc($month));
}
?>
</td>
</tr>
</table>
<?php
$numy++;}else{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear; ?>')">
<td><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.t; ?>"><?php echo $thisyear; ?>年</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> </td>
<td>
<?php
if($totalRows_month>0){
do{
$thismonth=substr($row_month['datetime'],5,2);
if($totalRows_month>$numm){
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear.m.$thismonth; ?>')">
<td width="35"><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.m.$thismonth.t; ?>"></td>
<td><?php echo $thismonth; ?>月</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear.m.$thismonth; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="51"><img src="images/line.gif" width="16" height="17"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>1日</td>
</tr>
<tr>
<td><img src="images/line.gif" width="16" height="17"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>2日</td>
</tr>
<tr>
<td><img src="images/line.gif" width="16" height="17"><img src="images/turn.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>10日</td>
</tr>
</table>
<?php $numm++;}else{ ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr onclick="thisdisplay('<?php echo y.$thisyear.m.$thismonth; ?>')">
<td width="35"><img src="images/clsfold.gif" width="35" height="17" id="<?php echo y.$thisyear.m.$thismonth.t; ?>"></td>
<td><?php echo $thismonth; ?>月</td>
</tr>
</table>
<table width="100%" id="<?php echo y.$thisyear.m.$thismonth; ?>" style="display:none" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17"> </td>
<td width="34"><img src="images/t.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>1日</td>
</tr>
<tr>
<td> </td>
<td><img src="images/turn.gif" width="16" height="17"><img src="images/text.gif" width="16" height="17"></td>
<td>10日</td>
</tr>
</table>
<?php
}
}while($row_month = mysql_fetch_assoc($month));
}
?>
</td>
</tr>
</table>
<?php }?>
<?php } // Show if recordset not empty ?>
<?php } while ($row_year = mysql_fetch_assoc($year)); ?></td>
</tr>
</table>
<?php
mysql_free_result($year);mysql_free_result($month);
?>
解决方案 »
- 菜鸟想学PHP,可不知道该如何下手,请问各位老大,能否给小弟指条明路想走些弯路!
- getgpc()怎么用?用处是什么?
- 请问大家都用什么版本的LINUX!
- 即使关了浏览器,php仍将在服务器上运行的方法zz
- mysql_unbuffered_query与mysql_query的区别?
- 求助,急!关于php的module
- 各位大侠.谁知道这个网站是用什么开发的呢?
- 要建一个社团(以后可能是公司)的论坛,是使用php技术的论坛社区,要求实用,不用太花哨,稳定,无版权问题,请推荐一个,谢谢
- 请问这个问题,希望在线的朋友帮忙??
- 关于PWS+PHP的问题
- 请问如何将用户填入的表单信息,发送到指定邮箱!100分
- 帮我看看这个错误是什么原因
# phpMyAdmin MySQL-Dump
# version 2.3.2
# http://www.phpmyadmin.net/ (download page)
#
# 主机: localhost
# 建立日期: Oct 10, 2003 at 04:04 PM
# 伺服机版本: 3.23.57
# PHP 版本: 4.3.2
# 数据库 : `notebook`
# --------------------------------------------------------#
# 数据表的结构 `mydates`
#CREATE TABLE mydates (
id int(15) NOT NULL auto_increment,
name varchar(20) NOT NULL default '',
datetime datetime NOT NULL default '0000-00-00 00:00:00',
contents text NOT NULL,
outorin char(1) NOT NULL default '1',
UNIQUE KEY id (id)
) TYPE=MyISAM;#
# 导出下面的数据库内容 `mydates`
#INSERT INTO mydates VALUES (1, 'kingerq', '2003-10-08 16:12:29', ' 不错不错,我喜欢这些东西 啦。只是现在不太好用,我只想把它做成一个功能齐全的东西。哈哈哈。我喜欢。', '1');
INSERT INTO mydates VALUES (2, 'kingerq', '2003-09-09 10:05:18', ' 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗??', '1');
INSERT INTO mydates VALUES (3, 'kingerq', '2003-10-09 10:05:25', ' 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗??', '1');
INSERT INTO mydates VALUES (4, 'kingerq', '2002-01-01 10:05:30', ' 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?', '1');
INSERT INTO mydates VALUES (5, 'kingerq', '2002-01-10 10:05:38', ' 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗?? 哈哈,这里好吗?可是能看吗??', '1');
INSERT INTO mydates VALUES (6, 'kingerq', '2003-06-01 10:05:55', ' 哈哈,这里好吗?可是能看吗??怎么不能看了呀??? ', '1');
INSERT INTO mydates VALUES (7, 'kingerq', '2002-10-09 10:06:18', ' 哈哈,这里好吗?可是能看吗??怎么不能看了呀??? 哈哈,这里好吗?可是能看吗??怎么不能看了呀??? 哈哈,这里好吗?可是能看吗??怎么不能看了呀???', '1');
INSERT INTO mydates VALUES (8, 'kingerq', '2002-10-10 10:09:43', '哈???', '1');
INSERT INTO mydates VALUES (9, 'kingerq', '2003-10-10 10:36:18', 'aaa', '1');
INSERT INTO mydates VALUES (10, 'kingerq', '2003-10-10 10:36:22', 'bbb', '1');
INSERT INTO mydates VALUES (11, 'kingerq', '2003-10-10 10:36:33', 'bbb', '1');
INSERT INTO mydates VALUES (12, 'kingerq', '2003-10-10 10:36:37', 'bbb', '1');
//连接和选择库省略
$query_year = "SELECT
YEAR(datetime),
MONTH(datetime),
DAYOFMONTH(datetime),
mydates.* FROM mydates order by datetime";
$rs = mysql_query($query_year, $notebook) or die(mysql_error());$oy = $om = $od = 0;
while(list($y,$m,$d,$id) = mysql_fetch_row($rs)) {
if($y > $oy) {
$om = $od = 0;
$oy = $y;
$ar[] = array(id=>$y,pid=>0,text=>"{$y}年");
}
if($m > $om) {
$od = 0;
$om = $m;
$ar[] = array(id=>sprintf("%d%02d",$y,$m),pid=>$y,text=>"{$m}月");
}
if($d > $od) {
$od = $d;
$ar[] = array(id=>sprintf("%d%02d%02d",$y,$m,$d),pid=>sprintf("%d%02d",$y,$m),text=>"{$d}日");
}
}include "tree_class.inc.php";$t = new tree;
foreach($ar as $v) {
$t->insert($v);
}
$t->display();
?>
tree_class.inc.php
<?
class Tree {
var $data = array();
var $tpl = '<table cellpadding=0 cellspacing=0 border=0 style="font-size:9pt">$块</table>';
var $block = '<tr onClick="tree_onclick()" bs=$标识><td>$主图标</td><td>$副图标 $文字</td></tr><tr style="display:$可见"><td background="$连线"></td><td value="$编号">$子树</td></tr>'; var $images = array( // 节点图片
array("images/tree_L.gif","images/tree_T.gif","images/icon-page.gif"),
array("images/OpenFolder_L.gif","images/OpenFolder_T.gif","images/FolderClose.gif","images/FolderOpen.gif"),
array("images/CloseFolder_L.gif","images/CloseFolder_T.gif","images/FolderClose.gif","images/FolderOpen.gif"),
array("none","images/tree_I.gif"),
); var $bond = array("","数据加载中...");
var $all = false; // 是否产生一棵子树
var $child_node_pos = 1; // 指示子节点出现的位置
var $js_display; /**
* Tree 构造函数
*/
function Tree() {
}
/**
* table 方法
* 功能 产生以表格方式组织的数据
* 说明 主要用于调试
*/
function table($format="",$head="") {
if(count($this->data) <= 0) return $this->out = "";
$out = "<table $format><tr>";
if($head == "") {
foreach($this->data as $v) break;
$head = array_keys($v);
}
foreach($head as $v)
$out .= "<th>$v</th>";
$out .= "</tr>";
foreach($this->data as $value) {
$out .= "<tr>";
foreach($head as $k)
$out .= "<td>$value[$k]</td>";
$out .= "</tr>";
}
return $this->out = "$out</table>";
}
/**
* node_all 方法
* 功能 根据模板构造全部数据
*/
function node_all($id, $key=array("id","pid","text","link")) {
$this->all = true;
return $this->node($id,$key);
}
/**
* index 方法
* 功能 索引树
*/
function index($start=0, $key=array("id","pid")) {
$fun = create_function('$a,$b'
,"if(\$a[$key[1]] == \$b[$key[1]]) return 0;"
."return \$a[$key[1]] > \$b[$key[1]]?1:-1;");
$out = array();
foreach($this->data as $k=>$v) {
if($v[$key[1]] == $start)
$out[] = $v;
else
$this->insert($v,&$out,$key);
}
return $this->data = $out;
}
/**
* insert 方法
* 功能 插入节点
*/
function insert($value,$array="",$key=array("id","pid")) {
if($array == "") $array =& $this->data;
if(count($array) <= 0) {
$array[] = $value;
return true;
}
$k = $m = $n = 0;
$ar = array();
foreach($array as $t) {
$k++;
if($t[$key[0]] == $value[$key[1]]) $m = $k;
if($t[$key[1]] == $value[$key[1]] || in_array($t[$key[1]],$ar)) {
$n = $k;
$ar[] = $t[$key[0]];
}
}
$k = max($m,$n);
if($k == 0) return false;
$array = array_merge(array_slice($array,0,$k),array($value),array_slice($array,$k));
$this->build($key);
return true;
}
/**
* update 方法
* 功能 修改节点
*/
function update() {
}
/**
* delete 方法
* 功能 删除节点
*/
function delete() {
}
/**
* move 方法
* 功能 移动节点
*/
function move() {
}
/**
* display 方法
* 功能 显示
*/
function display($type="node_all",$key=array("id","pid","text","link")) {
switch($type) {
case "table":
$this->table();
break;
case "node_all":
$this->out = $this->node_all(0,$key);
break;
}
echo $this->out;
$this->javascript();
}
function javascript() {
static $key;
if(! empty($key)) return;
echo <<< JS
<script>
function tree_onclick() {
el = event.srcElement;
switch(event.srcElement.tagName) {
case "A":
case "IMG":
while(el.tagName != "TR") el = el.parentElement;
break;
default:
return;
}
if(el.bs == 0) return; // bs=0 表示是叶节点; =1 为L接; >1 为T接
var pos = el.rowIndex;
var el1 = el.parentElement.rows[pos+1];
if(el1.style.display == "block") {
el1.style.display = "none";
el.cells[0].children[0].src = (el.bs==1?images[0][0]:images[0][1]);
if(el.cells[1]) if(el.cells[1].children[0]) el.cells[1].children[0].src = images[1][2];
}else {
el1.style.display = "block";
el.cells[0].children[0].src = (el.bs==1?images[1][0]:images[1][1]);
if(el.cells[1]) if(el.cells[1].children[0]) el.cells[1].children[0].src = images[1][3];
}
el = el1.cells[{$this->child_node_pos}];
if(el.innerHTML == bond) Tree_load.src = "?node="+el.value;
}
myload = 0;
function tree_load_end() { if(myload != 0) el.innerHTML = myload; }
</script>
<script id='Tree_load' src='' onreadystatechange='tree_load_end()'></script>
JS;
$js = "<script>\n";
$js .= "images = new Array(\nnew Array(";
foreach($this->images[1] as $v) $js .= "'$v',";
$js = substr($js,0,-1)."),\n";
$js .= "new Array(";
foreach($this->images[2] as $v) $js .= "'$v',";
$js = substr($js,0,-1).")\n);\n";
$js .= "bond = '{$this->bond[1]}';";
$js .= "</script>";
echo $js;
$key = 1;
}
function find($id,$key=array("id","pid")) {
foreach($this->data as $v)
if($v[$key[1]] == $id) return true;
return false;
}
/**
* filter方法
* 功能 返回$id的一级子集
*/
function filter($id,$key=array("id","pid")) {
$cmd = create_function('$var',"return(\$var[$key[1]]=='$id');");
return array_filter($this->data,$cmd);
}
/**
* node 方法
* 功能 根据模板构造指定节点数据
*/
function node($id,$key=array("id","pid","text","link")) {
$ar = $this->filter($id,$key);
if(($n = count($ar)) == 0) return "";
$块 = "";
foreach($ar as $value) {
$n--;
$p = sign($value[node_childs]);
$可见 = "none";//"block";
$标识 = $p==0 ? $p : $p+$n;
$主图标 = "<img src=\"{$this->images[$p][sign($n)]}\" align=absmiddle>";
$副图标 = empty($this->images[$p][2]) ? "" : "<img src=\"{$this->images[$p][2]}\" align=absmiddle>";
$文字 = empty($value[$key[3]]) ? $value[$key[2]] : "<a href=\"{$value[$key[3]]}\">{$value[$key[2]]}</a>";
$连线 = $this->images[3][sign($n)]; $编号 = $value[id];
$子树 = $this->all ? $this->node($value[$key[0]],$key) : $this->bond[$p];
$块 .= eval("return \"".AddSlashes($this->block)."\";");
}
return eval("return \"\n".AddSlashes($this->tpl)."\";");
}
/**
* build方法
* 功能 计算各节点的一级子节点数,用附加的node_childs表示
*/
function build($key=array("id","pid")) {
foreach($this->data as $k=>$v) {
$this->data[$k][node_childs] = count($this->filter($v[$key[0]]));
}
}
}?>
<?php
$images = array(
array('images/tree_I.gif','R0lGODlhEwAUAIAAAHt7e////yH5BAUUAAEALAAAAAATABQAAAIbjG+Ay+2tnpws0ist3kvz731bKF5kOZ3oo6IFADs='),
array('images/tree_L.gif','R0lGODlhEwAUAIAAAHt7e////yH5BAUUAAEALAAAAAATABQAAAIbjG+Ay+2tnpws0ist3kvzr4SB6H3miabqyhoFADs='),
array('images/tree_T.gif','R0lGODlhEwAUAIAAAHt7e////yH5BAUUAAEALAAAAAATABQAAAIdjG+Ay+2tnpws0ist3kv58GkcNJaJWYoopa6Z2xQAOw=='),
array('images/OpenFolder.gif','R0lGODlhEgASAJEAAP///29vbwAAAP///yH5BAUUAAMALAAAAAASABIAAAIunI+py+0mopxiCYBzrupqzSUeNgIhUqYWOZHB8B4puG50991ivlkU9QgKh8RHAQA7'),
array('images/OpenFolder_L.gif','R0lGODlhEgASAPcAAAAAAP///21tbQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAMALAAAAAASABIAAAhPAAcIHChQAMGDCBMqPGhwocB/ECNK/JfwX4CLGDFSRGgxY8aNBzteFBkAJEGSKCuOlDjSYMOHHz+q1CiTo8eaIW9qrDhxosOfQIMKHTogIAA7'),
array('images/OpenFolder_T.gif','R0lGODlhEgASAJEAAAAAAP///21tbf///yH5BAEAAAMALAAAAAASABIAAAIynG+Cy+2rngG0WtBA2JxjpnXdt4SbGZAIymandSrRNI6uZ4NiXu5edrlIEsNicWYcFgAAOw=='),
array('images/CloseFolder.gif','R0lGODlhEgASAJEAAP///29vbwAAAP///yH5BAUUAAMALAAAAAASABIAAAIvnI+py+0mopxiCYBzrupqzSXeh4XISJqHR5XB8K7kZs1lbauQDegDBXwIh8TiowAAOw=='),
array('images/CloseFolder_L.gif','R0lGODlhEgASAJEAAP///29vbwAAAP///yH5BAUUAAMALAAAAAASABIAAAIwnG+By+2rnhG0WtEE2JxjpnXdt4TiRiLmmR7hhSrRdHpZjd54S+/ZdZEIh8SicVAAADs='),
array('images/CloseFolder_T.gif','R0lGODlhEgASAJEAAP///29vbwAAAP///yH5BAUUAAMALAAAAAASABIAAAIxnG+By+2rnhG0WtEE2JxjpnXdt4TiRiLmmR7hhSrRdHpZjd54S+/ZdZEkhETirCgsAAA7'),
array('images/FolderClose.gif','R0lGODlhEgASALMAAP//Mf/zKf/vKf/rKf/nKf/jKf/fKf/bKf/XIf/PIf/HIf+qIca6MQAAAP///wAAACH5BAUUAA4ALAAAAAASABIAAARb0MlJq714sr1blgwgioyHcWjKLBQTvEM8FPSBLKbjBvJcI7ccQ0AkGA1IYFDToxVswASOGXNCEQmp0EhAGpRZreaYjGYVU5AVfEYLF/C4PJ5zNO74fP7D7/s/EQA7'),
array('images/FolderOpen.gif','R0lGODlhEgASAMQAAP/3Kf/zKf/vKf/rKf/nKf/jKf/fKf/bKf/XKf/TIf/PIf/LIf/HIf+qIca6MQAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAUUABAALAAAAAASABIAAAVfICSOZGmeKOmsazo6QBw7LizLLKvePP68vZ7jB8kZc4ChqBFoDp6FwuEwXBGZgecgOk1UlUst95BILBoP9KhBaBsMiPJiMVSvx/K5A01cNv6AgXwlD4WGh4YuiouMKSEAOw=='),
array('images/icon-expandall.gif','R0lGODlhEAAPAIAAAAAAAAAAACH5BAEAAAEALAAAAAAQAA8AQAIXjI+pBosAY3S02iOby/L6DzKcNYXmeRQAOw=='),
array('images/icon-closeall.gif','R0lGODlhEAAPAIAAAAAAAAAAACH5BAEAAAEALAAAAAAQAA8AQAIXjI+pwKzXonu0WgqujLf7D1aNtoUmUgAAOw=='),
array('images/icon-page.gif','R0lGODlhEAAQAKIEAP///wAAAH9/f8jIyP///wAAAAAAAAAAACH5BAEAAAQALAAAAAAQABAAAAM9SBSh/jCAIKqtbTEwueeZ9Imjwohk6UjsiT7bpzoC2IJQLXsZbZ+4h243ye0sPcXQMygaZYPkynWCWK+OBAA7')
);
if(! isset($_GET['id'])) {
echo "<table border>";
foreach($images as $k=>$v)
echo "<tr><td>$v[0]</td><td><img src='?id=$k'></td></tr>";
echo "</td></tr></table>";
}else {
echo base64_decode($images[$_GET['id']][1]);
if(0) // 1 写入文件,请保证目录存在且可写
foreach($images as $v) {
$fp = fopen($v[0],"wb");
fwrite($fp,base64_decode($v[1]));
fclose($fp);
}
}
?>
以前你也帮我解决了很多的问题,再次说声:谢谢!敬礼!
看了你的代码我真的觉得自己好惭愧,竟然有些看不太懂,至少很吃力,我想我肯定要一些时间来研究一下。如果你不介意的话,帮我讲解一下,还有在那个类(tree_class.inc.php)里第166-178行之间的这种结构我好像也没有见识过,对不起,我只是一个初学者,能说明一下吗??
==================================
Fatal error: Call to undefined function: sign() in F:\mysites\www\tree_class.inc.php on line 202
哦,对了,那个“节点图片”是不是放在tree_class.inc.php里的最后呀??
我测试结果除了上面的提示以外,还有那些节点图片和它们文件名的一个表格,在错误提示的上面显示。
$js = "<script>\n";
$js .= "images = new Array(\nnew Array("; // 连接串 与$js = $js."..." 等价
foreach($this->images[1] as $v) $js .= "'$v',"; // foreach 等价与 while(list(,$v)=each($array)) {...} ,但具有最高的效率
$js = substr($js,0,-1)."),\n";
$js .= "new Array(";
foreach($this->images[2] as $v) $js .= "'$v',";
$js = substr($js,0,-1).")\n);\n";
$js .= "bond = '{$this->bond[1]}';"; // 等价于$js .= "bond = '".$this->bond[1]."';"; ,书写成一个串时用{}将较长的变量表达式括起以防止歧异
$js .= "</script>";2、/*** 符号函数 ***/
function sign($v) {
if($v == 0) return 0;
return abs($v)/$v;
}3、节点图片是独立的图片数据,运行后可在浏览器中显示
改if(0) // 1 写入文件,请保证目录存在且可写中if(0) 为 if(1)
可将这些图片保存在程序所在目录的images子目录下,需自行保证images子目录存在且可写