如下面的代码所示,此代码的开头显示了一些错误。似乎它不期望私有变量。
有什么建议吗?这可能非常简单。
class Database { <--ERROR HERE
private db_host = 'localhost'; <--ERROR HERE
private db_user = 'root'; <--ERROR HERE
private db_pass = 'mysql89'; <--ERROR HERE
private db_name = 'faceshit'; <--ERROR HERE
public function connect() { ... REST OF CODE IS FINE
由于
答案 0 :(得分:1)
变量名前缺少$符号:
private $db_host = 'localhost';
private $db_user = 'root';
private $db_pass = 'mysql89';
private $db_name = 'faceshit';