//...
<?php
class Essentials {
//...
//...
static $root = $_SERVER['DOCUMENT_ROOT'];
}
//...
?>
Php写错误
Parse error: syntax error, unexpected '$_SERVER' (T_VARIABLE) in /Users/Dima/Desktop/localhost/YouLose/lib/lib.php on line 17
什么事?在课外,它有效。在php $ _SERVER中我知道“超全球”
答案 0 :(得分:1)
最好在构造函数中初始化它:
public List<Users> GetUsers(string[] groupNames)
{
List<Users> employees = new List<Users>();
string firstName = string.Empty;
string lastName = string.Empty;
string mail = string.Empty;
using (var context = new PrincipalContext(ContextType.Domain, "Name"))
{
foreach (var groupName in groupNames)
{
foreach (var userPrincipal in GroupPrincipal.FindByIdentity(context, groupName).GetMembers())
{
//code here please
employees.Add(new MPI.Domain.Entities.Users { First = firstName, Email = mail, Last = lastName });
}
}
}
return employees;
}