public function rules()
{
return CMap::mergeArray( parent::rules(),array(
array('third_link', 'urlArr'),
));
} public function urlArr($attribute, $params)
{
$arr = explode(chr(0), $this->third_link);
$pass = true;
$validator = new CUrlValidator();
$falseUrl = [];
foreach($arr as $v){
if(!$validator->validateValue($v)){
$pass = false;
$falseUrl[] = $v;
}
}
if(!$pass)
$this->addError($attribute, '第三方监测('.implode(', ', $falseUrl).') 不是有效的 URL');
return $pass;
}