我已經研究過一切。我不爲什麼我得到一個解析錯誤:語法錯誤,意想不到的「如果」(T_IF)在這部分意外如果語法錯誤
if(is_array($comment_contents) || is_object($comment_contents)){
這是我的全部代碼
<?php
if(is_array($home_contents) || is_object($home_contents)){
foreach($home_contents as $object_home){
echo'<div class="col-sm-offset-2">
<blockquote>
<p>' . $object_home->post_content .'</p>
<small>' . $object_home->poster_name . ' posted in <cite title="Source Title">'. $object_home->group_name .'<br/><br/></cite></small>
<form method="POST" action="<'. base_url('Home/getComment') .'>">
<input type="text" class="form-control hidden" name="postid" id="search" value="'. $object_home->post_id .'">
<button type="button" class="btn btn-default" data-toggle="collapse" aria-pressed="false" autocomplete="off" data-target="#demo"><span class="glyphicon glyphicon-comment"></span> Comment</button>
</form>
<div id="demo" class="collapse out">
<div class="form-group">
<label for="comment"></label>'.
if(is_array($comment_contents) || is_object($comment_contents)){
foreach ($comment_contents as $object_comment){
.'<h6>'. $object_comment->comment_content .' by '. $object_comment->full_name .' at '. $object_comment->post_date .'</h6>'.
}
}.'
<textarea class="form-control" rows="5" id="comment" placeholder="Enter Comment..."></textarea>
<p></p>
<div class="pull-right">
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-comment" aria-hidden="true"></span></button>
</div>
</div>
</div>
</blockquote>
</div>';
}
}
?>
任何幫助將是非常讚賞。
非常感謝你。這對我有效。 –
歡迎Marco –