錯誤說解析錯誤:語法錯誤,意想不到的T_STRING,上線11 期待T_VARIABLE我已經使用相同的代碼之前也和它在那裏工作精細爲什麼下面的php代碼不工作?
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
請查看[上類聲明PHP手冊(http://php.net/manual /en/language.oop5.php)。 PHP4的'var'關鍵字過時並且不再使用。 – 2012-07-28 13:50:22