Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
除了在自身内部重述父变量($username)之外,还有其他方法吗?
$username
$username = ($profile_is_admin == true) ? $username . $admin_symbol : $username;
if ($profile_is_admin) { $username .= $admin_symbol; }
尝试这个?
$username .= ($profile_is_admin) ? $admin_symbol : '';
像这样
$username .= ($profile_is_admin == true) ? $admin_symbol : '';