我正在学习 php,并在我的主机上放置了一个非常简单的类定义,并且在第一个属性定义时出现语法错误。
请参阅下面的前几行 - 错误是
解析错误:语法错误,意外的 T_STRING,需要 T_OLD_FUNCTION 或 T_FUNCTION 或 T_VAR 或 '}'
与第一个“公共”声明一致。
PHP 版本是“5.3.3-7+squeeze13 with Suhosin-Patch”。
如果我将“public”更改为“var”,代码会超过这一点,但会死于其他一些简单的语句(如“抛出异常”)。有用的友好类型声称代码在他们的本地开发环境中运行良好。
关于可能发生的事情以及如何解决它的任何建议?我是否需要将我(将近 20 年的)整个网站迁移到其他地方?
谢谢。
代码示例:
<?php
/* Class name: reBOOKed_User
* Description: Everthing that a user needs to have associated with them,
* including contact information, circle memberships, bookshelves, and
* points/pages earned.
*/
class reBOOKed_User
{
public $Username;
public $Password;
public $Emails = array(); #can have multiple emails associated with an account