本文整理匯總了PHP中CApplicationComponent::__unset方法的典型用法代碼示例。如果您正苦於以下問題:PHP CApplicationComponent::__unset方法的具體用法?PHP CApplicationComponent::__unset怎麽用?PHP CApplicationComponent::__unset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CApplicationComponent
的用法示例。
在下文中一共展示了CApplicationComponent::__unset方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __unset
/**
* Sets a component property to be null.
* Do not call this method. This is a PHP magic method that we override
* to allow using unset() to set a component property to be null.
* @param string $name the property name or the event name
* @throws CException if the property is read only.
* @return mixed
*/
public function __unset($name)
{
$setter = 'set' . $name;
if (property_exists($this->getClient(), $name)) {
$this->getClient()->{$name} = null;
} elseif (method_exists($this, $setter)) {
$this->{$setter}(null);
} else {
parent::__unset($name);
}
}
示例2: __unset
public function __unset($name)
{
if ($this->hasState($name)) {
$this->setState($name, null);
} else {
parent::__unset($name);
}
}
示例3: __unset
/**
* Magic unset function. Removes a given attribute
*
* @param string $name
*/
public function __unset($name)
{
$name = str_replace('_', '', $name);
parent::__unset($name);
}