本文整理汇总了PHP中Channel::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::validate方法的具体用法?PHP Channel::validate怎么用?PHP Channel::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($channel, $strict = true)
{
$exists = $this->exists($channel, $strict);
if (!$exists) {
throw new Exception('Channel ' . $channel . ' does not exist');
}
if (1 === $exists) {
// is a default channel not installed
return $this->getDefaultChannel($channel);
}
$channel = $this->channelFromAlias($channel);
$cont = file_get_contents($this->channelFileName($channel));
$a = @unserialize($cont);
if (!$a || !is_array($a)) {
throw new Exception('Channel ' . $channel . ' PEAR1 registry file is corrupt');
}
try {
$chan = new Channel($this, $a);
if ($channel != '__uri') {
$chan->validate();
}
return $chan;
} catch (\Exception $e) {
throw new Exception('Channel ' . $channel . ' PEAR1 registry file is invalid channel information', $e);
}
}
示例2: AddChannelToPoint
public function AddChannelToPoint($pointId)
{
$_pointId = $pointId;
$model = new Channel();
$res = Channel::model()->findAll('id_point=:id_point ORDER BY internalId ASC', array(':id_point' => $_pointId));
$internalId = 1;
if (count($res) > 0) {
$internalId = $res[count($res) - 1]['internalId'] + 1;
}
$model->attributes = array('id_point' => $_pointId, 'internalId' => $internalId);
if ($model->validate() && $model->save()) {
$id = $model->getPrimaryKey();
return array("status" => true, "id" => $id, "internalId" => $internalId);
} else {
return array("status" => false, "error" => json_encode($model->getErrors()));
}
}