本文整理汇总了PHP中validate::getMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP validate::getMsg方法的具体用法?PHP validate::getMsg怎么用?PHP validate::getMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validate
的用法示例。
在下文中一共展示了validate::getMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* 更新
*/
public function update($condition = '')
{
$this->checkRules('update');
$validateMsg = validate::getMsg();
if (empty($validateMsg)) {
if (is_array($this->data)) {
$data = $this->getData();
$sql = $this->implode_field_value($data);
} else {
$sql = $this->data;
}
if (empty($condition)) {
$where = '1';
} elseif (is_array($condition)) {
$condition = $this->getData($condition);
$where = $this->implode_field_value($condition, ' AND ');
} else {
$where = $condition;
}
debug::start();
$res = $this->db->query("UPDATE {$this->pre}{$this->table} SET {$sql} WHERE {$where}");
debug::end();
debug::add("UPDATE {$this->pre}{$this->table} SET {$sql} WHERE {$where} [" . debug::spent() . "]", 1);
return $res;
} else {
foreach ($validateMsg as $val) {
debug::add("对 {$this->pre}{$this->table} 表进行更新操作时验证不通过:" . $val);
}
return false;
}
}
示例2: saveAction
public function saveAction()
{
if (fpBase('http')->isPost()) {
M($this->table)->data = $_POST;
if (M($this->table)->save()) {
exit(json_encode(array('statusCode' => 200, 'message' => '操作成功', 'callbackType' => 'closeCurrent')));
} else {
foreach (validate::getMsg() as $val) {
exit(json_encode(array('statusCode' => 300, 'message' => $val)));
}
exit(json_encode(array('statusCode' => 300, 'message' => '操作失败')));
}
} else {
$this->display();
}
}