in need of fresh eyes
stupid question I know, but I need fresh eyes as I cannot see the error.
My code is this :
$element = $this->domDocument->getElementByTagName("Team");
for ($i =0 ; $i < $element.length ; $i ++ ) {
print $element[$i].childNodes[0].nodeValue;
}
and the error is :
PHP Parse error: syntax error, unexpected '[' on line 40
which is the line with the print statement.
Can you spot what is wrong?
$element = $this->domDocument->getElementsByTagName("Team");
for ($i =0 ; $i < $element->length ; $i ++ ) {
print $element[$i]->childNodes[0]->nodeValue;
}
我想你会混淆多种语言;)
PHP不使用点符号表示对象,而是使用对象操作符(箭头)。
$element = $this->domDocument->getElementsByTagName("Team");
for ($i =0 ; $i < $element->length ; $i ++ ) {
print $element[$i]->childNodes[0]->nodeValue;
}
链接地址: http://www.djcxy.com/p/58158.html
上一篇: 在PHP中使用对象操作符
下一篇: 需要新鲜的眼睛