Php unexpected T_VARIABLE, little help here
2 answers
You cannot use a variable there, you have to transfer it to a method. This is bad style, as the User class needs to know about $ _SERVER.
If you really want this, you can use:
private static $signInURL = '';
public static getSignInUrl()
{
if (User::$signInUrl == '') User::$signInUrl = $_SERVER....;
return User::$signInUrl;
}
I suggest using:
class User
{
private static $signInUrl = '/signin';
public static getSignInUrl($base)
{
return $base . User::$signInUrl;
}
}
+4
a source to share