本文整理汇总了PHP中Color::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::add方法的具体用法?PHP Color::add怎么用?PHP Color::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
$obj = new Color($this->db);
echo json_encode($obj->add($this->f3->get("POST.postdata")));
}
示例2: Color
<?php
require_once 'Color.class.php';
//print( Color::doc() );
Color::$verbose = True;
$red = new Color(array('red' => 0xff, 'green' => 0, 'blue' => 0));
$green = new Color(array('rgb' => 255 << 8));
$blue = new Color(array('red' => 0, 'green' => 0, 'blue' => 0xff));
$yellow = $red->add($green);
$cyan = $green->add($blue);
$magenta = $blue->add($red);
$white = $red->add($green)->add($blue);
print $red . PHP_EOL;
print $green . PHP_EOL;
print $blue . PHP_EOL;
print $yellow . PHP_EOL;
print $cyan . PHP_EOL;
print $magenta . PHP_EOL;
print $white . PHP_EOL;
Color::$verbose = False;
$black = $white->sub($red)->sub($green)->sub($blue);
print 'Black: ' . $black . PHP_EOL;
Color::$verbose = True;
$darkgrey = new Color(array('rgb' => (10 << 16) + (10 << 8) + 10));
print 'darkgrey: ' . $darkgrey . PHP_EOL;
$lightgrey = $darkgrey->mult(22.5);
print 'lightgrey: ' . $lightgrey . PHP_EOL;
$random = new Color(array('red' => 12.3, 'green' => 31.2, 'blue' => 23.1));
print 'random: ' . $random . PHP_EOL;
示例3: Color
<?php
if (Tools::P('saveColor') == 'add') {
$color = new Color();
$color->copyFromPost();
$color->add();
if (is_array($color->_errors) and count($color->_errors) > 0) {
$errors = $color->_errors;
} else {
$_GET['id'] = $color->id;
UIAdminAlerts::conf('创建对象成功');
}
}
if (isset($_GET['id'])) {
$id = (int) $_GET['id'];
$obj = new Color($id);
}
if (Tools::P('saveColor') == 'edit') {
if (Validate::isLoadedObject($obj)) {
$obj->copyFromPost();
$obj->update();
}
if (is_array($obj->_errors) and count($obj->_errors) > 0) {
$errors = $obj->_errors;
} else {
UIAdminAlerts::conf('更新对象成功');
}
}
$colors = Color::getEntitys();
if (isset($errors)) {
UIAdminAlerts::MError($errors);