2012-10-14 67 views
1

我得到这个奇怪的问题,我的PHP脚本。PHP语法错误问题

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING 
in simpleTest.php on line 82 

我不知道为什么我的代码不工作。

<?php 
    foreach ($response->getPods() as $pod) { 
?> 
     <tr> 
     <td> 
      <h3><?php echo $pod->attributes['title']; ?></h3> //line 82..this gives me error... 


    <?php 
      foreach ($pod->getSubpods() as $subpod) { 
    ?> 
    <img src="<?php echo $subpod->image->attributes['src']; ?>"> //this would gives me error too... 
       <hr> 
    <?php 
      } 
    ?> 

感谢您的帮助!

+0

关闭所有foreach循环 –

+0

你确定它不应该是$ pod-> attributes-> title – jtheman

+0

@Kolink现在它确实告诉你了吗? – Songo

回答

1
<?php foreach ($response->getPods() as $pod) { 
     echo "<tr><td><h3>".$pod->attributes['title']."</h3>"; 
     foreach ($pod->getSubpods() as $subpod) { 
      echo "<img src='".$subpod->image->attributes['src']."'><hr>"; 
     } 
}?> 

Coderabbi的权利,有一个失踪的卷曲。

2

您错过了外部foreach循环的闭合大括号。