class MyClass
{
const EVENT_NAME='Name of the event';
const EVENT_DATE='xx/xx/xxxx';
public $eventName = self::EVENT_NAME.' '.self::EVENT_DATE;
}
不起作用! 我想在变量中连接2个常量。
答案 0 :(得分: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;
}