【发布时间】:2013-09-18 14:40:31
【问题描述】:
class List {
public function hello()
{
return "hello";
}
}
$list = new List;
echo $list::hello();
给出错误:
PHP Parse error: syntax error, unexpected 'List' (T_LIST), expecting identifier (T_STRING) in /home/WtGTRQ/prog.php on line 3
将“List”更改为“Lizt”可以解决问题。
我很遗憾地理解 Php functions are case-insensitive,但我真的不想让 List 对象成为 Lizt 对象......有没有办法在不重命名我的类的情况下规避这个问题?
【问题讨论】:
-
MyList或者更多关于列表内容的内容怎么样? -
简短回答:不。长答案:也没有。
标签: php function class case-sensitive