【发布时间】:2012-04-20 15:19:56
【问题描述】:
我在命名函数时遇到问题。我有一门课,我需要 2 个函数,如下所示。
class myclass {
public function tempclass () {
echo "default";
}
public function tempclass ( $text ) {
echo $text;
}
}
当我打电话时
tempclass('testing'); // ( called after creating the object )
function tempclass() 正在被调用,我如何才能拥有 2 个名称相同但参数不同的函数?
【问题讨论】:
-
为什么你的代码使用引号格式而不是代码格式?