类 My_class { const STATUS_ERROR = 0; const STATUS_OK = 1; const DB_TABLE = TABLE_PREFIX . 'class_table'; }
这两个状态常量可以在类方法中使用self::STATUS_ERROR
和self::STATUS_OK
。
问题在于如何避免定义第三个常量时出现以下错误:
Parse error: syntax error, unexpected '.', expecting ',' or ';' in /home/sub/sub/directory/script.php