相关疑难解决方法(0)

如何初始化静态变量

我有这个代码:

private static $dates = array(
  'start' => mktime( 0,  0,  0,  7, 30, 2009),  // Start date
  'end'   => mktime( 0,  0,  0,  8,  2, 2009),  // End date
  'close' => mktime(23, 59, 59,  7, 20, 2009),  // Date when registration closes
  'early' => mktime( 0,  0,  0,  3, 19, 2009),  // Date when early bird discount ends
);
Run Code Online (Sandbox Code Playgroud)

这给了我以下错误:

解析错误:第19行/home/user/Sites/site/registration/inc/registration.class.inc中的语法错误,意外'(',期待')'

所以,我想我做错了什么......但是如果不是那样的话怎么办呢?如果我用常规字符串更改mktime内容,它就可以工作.所以,我知道我能做到这一点的那种像..

有人有指点吗?

php class static-members

204
推荐指数
5
解决办法
20万
查看次数

标签 统计

class ×1

php ×1

static-members ×1