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
相关文档:
<?php
/*
* -------------------------------------------------
* Author : Fanglor
* Email : Fanlor@163.com
* Url : www.skyleft.com
* Date : 2009-10-13
* -------------------------------------------------
*/
function arr_foreach ($arr) {
if (!is_array ($arr)) {
return fa ......
0、用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(译注:PHP手册中说echo是语言结构,不是真正的函数,故把函数加上了双引号)。
1、如果能将类的方法定义成static ......
http://blog.csdn.net/microji/archive/2008/12/19/3551042.aspx
做一个首页调用图像,有时候往往需要获得固定大小的图像,因为首页的图像位置通常由设计人员指定好了,如果是做最新发布图像调用,因为不知道客户会上传什
么比例的图像,所以,有时候也就没有办法确定图像的比例,前台页面编写人员通常会采用固定 i ......
在做邯郸房产网的时候遇到php获取checkbox的问题:asp获取表单中的复选框的值,直接就是以“,”(逗号)为分隔符的数组。php中确总是只获取最后一个复选框的值。
解决办法:
form表单的部分代码:
<input type="checkbox" name="frm_tag[]" id="frm_tag" value="1">1
<input type="checkbox" name=" ......