【发布时间】:2014-07-03 03:28:38
【问题描述】:
我不确定标题是否正确,我的问题是我里面有一个类和函数,我想检查函数的值是否设置,如果没有设置其他值
class some_class
{
private $width;
function width( $value )
{
// Set another default value if this is not set
$this->width = $value;
}
}
$v = new some_class();
// Set the value here but if I choose to leave this out I want a default value
$v->width( 150 );
【问题讨论】:
-
如果您使用的是 setter 方法,请按原样调用它:
setWidth。