0
class MyClass
{
    const EVENT_NAME='Name of the event';

    const EVENT_DATE='xx/xx/xxxx';

    public $eventName = self::EVENT_NAME.' '.self::EVENT_DATE;
}

不工作!我想在一个变量中连接 2 个常量。

4

1 回答 1

4
class MyClass
{
    const EVENT_NAME='Name of the event';

    const EVENT_DATE='xx/xx/xxxx';

    public function __construct() {
        $this->eventName = self::EVENT_NAME.' '.self::EVENT_DATE;
    }

    public $eventName;
}
于 2013-02-11T12:06:55.957 回答