PHP - error: Strict standards: Resource ID#2 used as offset, casting to integer (2) en ...

 
Vista:

error: Strict standards: Resource ID#2 used as offset, casting to integer (2) en ...

Publicado por luis (1 intervención) el 08/04/2017 13:24:21
buenas, tengo el siguiente codigo, pero a la hora de ejecutarlo me da error:
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
<!DOCTYPE html>
<html>
<head>
<meta charset="uft-8">
<title>Mi primer ejemplo</title>
</head>
 
<body>
<?php
$file = "ppppp.xml";
$depth = array();
 
function startElement($parser, $name, $attrs) {
    global $depth;
    for ($i = 0; $i < $depth[$parser]; $i++) {
        print "--";
    }
    print "$name";
    $depth[$parser]++;
}
 
function endElement($parser, $name) {
    global $depth;
    $depth[$parser]--;
}
 
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!($fp = fopen($file, "r"))) {
    die("could not open XML input");
}
 
while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);
?>
</body>
</html>

el error que sale es el siguiente:
Strict standards: Resource ID#2 used as offset, casting to integer (2) en ...

alguien sabe el motivo??? gracias
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
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

error: Strict standards: Resource ID#2 used as offset, casting to integer (2) en ...

Publicado por xve (6935 intervenciones) el 09/04/2017 18:53:34
Hola Luis, en que linea te da ese error?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar