以下代码不起作用,我得到了一个白屏。不知道出了什么问题。另外,我不确定将 $member_info 传递给 javascript 并使用 jQuery 遍历 html 是否会更好?
PHP:
foreach($team_member as $member)
{
$is_leader= false;
if(naked_id($member->id) == naked_id($leader->id)){
$is_leader = true;
}
unset($member_data);
$member_data->id = $member->id;
$member_data->leader = $is_leader;
$member_info[] = $member_data;
}
HTML:
<?php foreach($member_info as $member) : ?>
<?php if ( $member->leader == true ) : ?>
<span id="team-leader">Team Leader</span>
<?php else : ?>
<span id="team-leader" style="display:none;">Team Leader</span>
<?php endif ?>
<?php endforeach ?>