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 ......
一.环境的安装
下载安装包,Google上搜索php+apache+sql的安装包并安装。
二.扩展编程
针对在PHP环境下掉用C编程(c程序编译的dll),主要有以下两种方式。
1.利用ATL构建DLL组件,然后再PHP里面直接调用,调用方法 ......
一. 首先做一个简单的so文件:
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared ......
PHP新的连接MySQL方法mysqli
1. 开启PHP的API支持
(1)首先修改您的php.ini的配置文件。
查找下面的语句:
;extension=php_mysqli.dll
将其修改为:
extension=php_mysqli.dll
......
原文参考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 ......