PHP无限梯归
<?php
class Tree
{
// public $data=array();//所有节点值
// public $cateArray=array();//所有父节点
function Tree()
{
}
//setNode(目录ID,上级ID,目录名字);
function setNode ($id, $parent, $value){
$parent = $parent?$parent:0;
$this->data[$id] = $value;//获取当前ID对应的当前目录名
$this->cateArray[$id] = $parent;//获取当前ID对应的父分类ID
//echo $id."->".$this->cateArray[$id]."--".$this->data[$id]."<br>";
}
function getChilds($id=0)
{
$childArray=array();
$childs=$this->getChild($id);
foreach ($childs as $child)
{
$childArray[]=$child;
$childArray=array_merge($childArray,$this->getChilds($child));//id 递归 累加
}
return $childArray;
}
function getChild($id)
{
&nbs
相关文档:
0、用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(译注:PHP手册中说echo是语言结构,不是真正的函数,故把函数加上了双引号)。
1、如果能将类的方法定义成static ......
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->ge ......
原文参考http://www.cnblogs.com/xxcainiao/archive/2009/04/18/1438482.html
稍作修改,做了一个goto按钮:
<!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/xh ......
1. Joomla!
2007年开源cms第一名!Joomla!是使用PHP语言加上MySQL数据库所开发的软件系统,可以在 Linux、Windows、MacOSX等各种不同的平台上执行。操作接口除了美观之外,也花了很多心力在设计这些接口的简易操作性。但初次使用者,需 ......
在做邯郸房产网的时候遇到php获取checkbox的问题:asp获取表单中的复选框的值,直接就是以“,”(逗号)为分隔符的数组。php中确总是只获取最后一个复选框的值。
解决办法:
form表单的部分代码:
<input type="checkbox" name="frm_tag[]" id="frm_tag" value="1">1
<input type="checkbox" name=" ......