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.
我一直在寻找这个好几天。居然没有回答,真是意外。我有一个 PHP 表单,我想只显示没有域前缀的 IIS 登录用户。它一直让我发疯!感谢您的关注。
这就是我现在拥有的:
$user = $_SERVER['REMOTE_USER']; echo "$user"; ?>" type="text" readonly="readonly" name="uneditablefield"/>
你为什么不直接砍掉前缀?
$user = $_SERVER['REMOTE_USER']; $user = array_pop (explode ("\\", $user)); echo "$user"; ?>" type="text" readonly="readonly" name="uneditablefield"/>
您是否尝试过使用 str_ireplace() 删除域\?假设域是恒定的,否则 Jon 的评论将是更好的选择。