我正在处理一部分用户发布他们的状态。并且该帖子将被社区中的其他成员看到,并且他们想要隐藏删除帖子选项,以形成群组/社区的其他成员"或者只是删除帖子选项仅供发布它的用户使用..!通过以下建议我已经相应地编辑了我的代码,但它给了我一个错误解析错误:语法错误,意外'如果' (T_IF)
code.php
echo '<div class="col-lg-12">
<div class="social-feed-box">' .if($_SESSION['via'] == $row['via']){.
'<div class="pull-right social-action dropdown">
<button data-toggle="dropdown" class="dropdown-toggle btn-white">
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu m-t-xs">
<li><a href="post_delete.php">Delete</a></li>
</ul>
</div>' .}. '<div>.....
答案 0 :(得分:0)
试试这个
<?php
$_SESSION['via'] =1;
$row['via'] =1;
echo '<div class="col-lg-12">
<div class="social-feed-box">';
if($_SESSION['via'] == $row['via']) {
echo '<div class="pull-right social-action dropdown">
<button data-toggle="dropdown" class="dropdown-toggle btn-white">
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu m-t-xs">
<li><a href="post_delete.php">Delete</a></li>
</ul>';
}
echo '</div>';
?>