本文整理匯總了PHP中Brand::copyFromPost方法的典型用法代碼示例。如果您正苦於以下問題:PHP Brand::copyFromPost方法的具體用法?PHP Brand::copyFromPost怎麽用?PHP Brand::copyFromPost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Brand
的用法示例。
在下文中一共展示了Brand::copyFromPost方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Brand
<?php
if (Tools::P('sveBrand') == 'add') {
$brand = new Brand();
$brand->copyFromPost();
if ($brand->add() && $brand->updateLogo()) {
UIAdminAlerts::conf('品牌已更新');
}
if (is_array($brand->_errors) and count($brand->_errors) > 0) {
$errors = $brand->_errors;
}
}
if (isset($_GET['id'])) {
$id = (int) Tools::G('id');
$obj = new Brand($id);
}
if (isset($_POST['sveBrand']) && Tools::P('sveBrand') == 'edit') {
if (Validate::isLoadedObject($obj)) {
$obj->copyFromPost();
if ($obj->update() && $obj->updateLogo()) {
if (!isset($_FILES['qqfile']['name']) || isset($_FILES['qqfile']['name']) && $obj->updateLogo()) {
UIAdminAlerts::conf('品牌已更新');
}
}
}
if (is_array($obj->_errors) and count($obj->_errors) > 0) {
$errors = $obj->_errors;
}
}
if (isset($errors)) {
UIAdminAlerts::MError($errors);
示例2: loadBrand
public function loadBrand($str_brand)
{
$id_brand = 0;
if (!($result = $this->_brandExists($str_brand))) {
$brand = new Brand();
$brand->copyFromPost();
$brand->name = pSQL($str_brand);
$brand->rewrite = "brand-" . pSQL(preg_replace("/[^-0-9a-zA-Z]+/", "", str_replace(' ', '-', trim($str_brand))));
$brand->add();
$id_brand = $brand->id;
} else {
$id_brand = $result;
}
return $id_brand;
}