PHP - Consulta, que hace esto? json php array

 
Vista:

Consulta, que hace esto? json php array

Publicado por Franco (2 intervenciones) el 15/02/2012 13:26:15
buenas....
llego a ustedes con esta consulta....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
 
	$id = $_POST['node'];
 
	$nodes = array(
		array(
			'id'=>1,
			'text'=>'Program Files',
			'files'=>array(
				array(
                                        'id'=>5,
					'text'=>'File'
 
				),
				array(
					'text'=>'Config',
					'leaf'=>true
				),
				array(
					'text'=>'etc',
					'leaf'=>true
				)
			)
		),
		array(
			'id'=>2,
			'text'=>'Users',
			'leaf'=>true
		),
		array(
			'id'=>3,
			'text'=>'workspace',
			'files'=>array(
				array(
					'text'=>'Customers',
					'leaf'=>true
				),
				array(
					'text'=>'Project',
					'leaf'=>true
				)
			)
		),
		array(
			'id'=>4,
			'text'=>'System',
			'leaf'=>true
		)
	);
 
	if(is_numeric($id)){
		$nodes = isset($nodes[$id-1]['files'])?$nodes[$id-1]['files']:array();
	}
 
	echo json_encode($nodes);
?>


las ultimas lineas del if en adelante no tengo idea que hacen.... :S


de antemano muchas gracias
saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder