-1

错误说 Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE on line 11 我以前也使用过相同的代码,它在那里工作正常

class connection{

// variables for cms login

var $admin_name1 = "name";
var $admin_passwd1 = "passwd";
// variable to recieve data from form 

var rename;    //********** this line is giving error
var repasswd;

function cms_login()
{
if(($this->rename == $this->admin_name1) && ($this->repasswd == $this->admin_passwd1)){ // access granted 
echo 'Access granted<br>';
echo 'Please wait while you are being redirected';
session_start();
$_SESSION['piratica']="active";
$redirect = "Location: landing.php";
echo header($redirect);
}
else { // access denied
echo 'WARNING  !!';
echo '<br>Wrong login details.';

}

} // function cms_login ends here 


} // class connection ends here
4

2 回答 2

3

您忘记了$变量名前面的符号。

var $rename;    //********** this line is giving error
var $repasswd;
于 2012-07-28T13:48:14.950 回答
0

php中的所有变量都以$开头

您忘记添加 rename 和 repasswd 变量

于 2012-07-28T13:50:11.067 回答