错误说解析错误:语法错误,意外T_STRING,在第11行期待T_VARIABLE 我之前也使用过相同的代码,它在那里工作正常
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
答案 0 :(得分:3)
您忘记了变量名称前面的$
符号。
var $rename; //********** this line is giving error
var $repasswd;
答案 1 :(得分:0)
php中的所有变量都以$
开头您忘记添加重命名和修复变量