本文整理汇总了PHP中check_empty函数的典型用法代码示例。如果您正苦于以下问题:PHP check_empty函数的具体用法?PHP check_empty怎么用?PHP check_empty使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_empty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("levelname");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['levelname'])) {
$this->error("请填写星级名称");
}
if (!preg_match('/^[0-9]*[1-9][0-9]*$/', $data['level'])) {
$this->error("请填写级别");
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
$dbErr = M()->getDbError();
save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0);
$this->error(L("UPDATE_FAILED") . $dbErr);
}
}
示例2: insert
public function insert()
{
B('FilterString');
$ajax = intval($_REQUEST['ajax']);
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("ADV_NAME_EMPTY_TIP"));
}
if (!check_empty($data['code'])) {
$this->error(L("ADV_CODE_EMPTY_TIP"));
}
if ($data['tmpl'] == '') {
$this->error(L("ADV_TMPL_EMPTY_TIP"));
}
if ($data['adv_id'] == '') {
$this->error(L("ADV_IDS_EMPTY_TIP"));
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
示例3: insert
public function insert()
{
B('FilterString');
$ajax = intval($_REQUEST['ajax']);
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error("请输入分类名称");
}
$user_level_list = M(MODULE_NAME)->where("point=" . intval($data['point']))->find();
if ($user_level_list) {
$this->error('已有相同的"所需信用值"');
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
示例4: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['name'])) {
$this->error(L("ATTR_NAME_EMPTY_TIP"));
}
if (!check_empty($data['preset_value']) && $data['input_type'] == 1) {
$this->error(L("PRESET_VALUE_EMPTY_TIP"));
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例5: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$user_names = preg_split("/[ ,]/i", $data['user_names']);
$user_ids = "";
foreach ($user_names as $k => $v) {
$uid = M("User")->where("user_name = '" . $v . "'")->getField("id");
if ($uid) {
$user_ids .= $uid . "|";
}
}
$data['user_ids'] = $user_ids;
$data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['title'])) {
$this->error(L("MSY_TITLE_EMPTY_TIP"));
}
if (!check_empty($data['content'])) {
$this->error(L("MSY_CONTENT_EMPTY_TIP"));
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例6: update
public function update()
{
B('FilterString');
$data = M("ApnsMessages")->create();
$log_info = $data['id'];
//开始验证有效性
$this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id'])));
if (!check_empty($data['content'])) {
$this->error(L("CONTENT_EMPTY_TIP"));
}
if ($data['send_time'] == '') {
$data['send_time'] = get_gmtime();
}
$data['send_time'] = to_timespan($data['send_time']);
if (intval($_REQUEST['resend']) == 1) {
$data['status'] = 0;
}
$list = M("ApnsMessages")->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例7: insert
public function insert()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("DEALCATE_NAME_EMPTY_TIP"));
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
clear_auto_cache("cache_shop_cate_tree");
clear_auto_cache("shop_sub_cate_ids");
clear_auto_cache("shop_sub_parent_cate_ids");
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
示例8: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['name'])) {
$this->error(L("VOUCHER_NAME_EMPTY_TIP"));
}
if (doubleval($data['money']) <= 0) {
$this->error(L("VOUCHER_MONEY_ERROR_TIP"));
}
$data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
$data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("use_limit", $data['use_limit']);
//同步可用次数
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("begin_time", $data['begin_time']);
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("end_time", $data['end_time']);
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("money", $data['money']);
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例9: update
public function update()
{
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("TAGNAME_EMPTY_TIP"));
}
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
$log_info = $data['name'];
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
M("TagGroupLink")->where("tag_group_id=" . $data['id'])->delete();
foreach ($_REQUEST['cate_id'] as $cate_id) {
if (intval($cate_id) > 0) {
$link_data = array();
$link_data['category_id'] = intval($cate_id);
$link_data['tag_group_id'] = $data['id'];
M("TagGroupLink")->add($link_data);
}
}
clear_auto_cache("store_filter_nav_cache");
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例10: update
public function update()
{
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit"));
if (!check_empty($data['name'])) {
$this->error(L("POINTNAME_EMPTY_TIP"));
}
if (M(MODULE_NAME)->where("id<>" . $data['id'] . " and `name`='" . $data['name'] . "'")->count() > 0) {
$this->error(L("HAD_POINTGROUP"));
}
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
$log_info = $data['name'];
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例11: get
public function get()
{
$key_word = check_empty($this->input->get('keyword'), '');
$city_id = input_int($this->input->cookie('cityid'), 100000, FALSE, '530700');
//默认丽江
$page = input_int($this->input->get('page'), 1, FALSE, 1);
$perpage = input_int($this->input->get('perpage'), 1, 20, 10);
$category = input_int($this->input->get('cid'), 0, FALSE, 0);
$category_id = input_int($this->input->get('ccid'), 0, FALSE, 0);
$dest_id = input_int($this->input->get('dest'), 0, FALSE, 0);
$local_id = input_int($this->input->get('local'), 0, FALSE, 0);
$sort = input_string($this->input->get('sort'), array('time', 'local', 'highp', 'lowp'), 'time');
$today = input_int($this->input->get('today'), 0, 2, 0);
$order_by = array('time' => 'update_time DESC', 'local' => 'local', 'highp' => 'bought_count DESC', 'lowp' => 'price ASC');
$type = input_string($this->input->get('type'), array('item', 'inn'), 'item');
$search = array('category' => $category, 'category_id' => $category_id, 'city_id' => $city_id, 'local_id' => $local_id, 'dest_id' => $dest_id, 'state' => 'T', 'today' => $today, 'type' => $type, 'key_word' => $key_word);
if ($order_by[$sort] == 'local') {
$search['lat'] = $this->get_current_data('lat');
$search['lon'] = $this->get_current_data('lon');
}
if ($type == 'item') {
$data = $this->model->get_products($search, $order_by[$sort], build_limit($page, $perpage));
} else {
$data = $this->model->get_inns($search, $order_by[$sort], build_limit($page, $perpage));
}
response_row($data);
}
示例12: insert
public function insert()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
if ($data['pid'] > 0) {
$data['recommend'] = 0;
}
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("DEALCATE_NAME_EMPTY_TIP"));
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
示例13: insert
public function insert()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/index"));
if (!check_empty($data['name'])) {
$this->error(L("DEALCATE_NAME_EMPTY_TIP"));
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//标签分组
$tag_group = $_REQUEST['tag_group'];
foreach ($tag_group as $group_id) {
if ($group_id > 0) {
$tag_group_link['tag_group_id'] = intval($group_id);
$tag_group_link['category_id'] = intval($list);
M("TagGroupLink")->add($tag_group_link);
}
}
//图片分组
$images_group = $_REQUEST['images_group'];
foreach ($images_group as $images_id) {
if ($images_id > 0) {
$images_group_link['images_group_id'] = intval($images_id);
$images_group_link['category_id'] = intval($list);
M("ImagesGroupLink")->add($images_group_link);
}
}
//点评评分分组
$point_group = $_REQUEST['point_group'];
foreach ($point_group as $group_id) {
if ($group_id > 0) {
$point_group_link['point_group_id'] = intval($group_id);
$point_group_link['category_id'] = intval($list);
M("PointGroupLink")->add($point_group_link);
}
}
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
clear_auto_cache("cache_youhui_cate_tree");
clear_auto_cache("deal_sub_cate_ids");
clear_auto_cache("deal_sub_parent_cate_ids");
clear_auto_cache("store_image_group_list");
clear_auto_cache("byouhui_filter_nav_cache");
clear_auto_cache("fyouhui_filter_nav_cache");
clear_auto_cache("tuan_filter_nav_cache");
clear_auto_cache("ytuan_filter_nav_cache");
clear_auto_cache("store_filter_nav_cache");
clear_auto_cache("cache_deal_cate");
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
示例14: insert
public function insert()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("DEALCATE_NAME_EMPTY_TIP"));
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
// //标签分组
// $tag_group = $_REQUEST['tag_group'];
// foreach($tag_group as $group_id)
// {
// if($group_id>0)
// {
// $tag_group_link['tag_group_id'] = intval($group_id);
// $tag_group_link['category_id'] = intval($list);
// M("TagGroupLink")->add($tag_group_link);
// }
// }
// //图片分组
// $images_group = $_REQUEST['images_group'];
// foreach($images_group as $images_id)
// {
// if($images_id>0)
// {
// $images_group_link['images_group_id'] = intval($images_id);
// $images_group_link['category_id'] = intval($list);
// M("ImagesGroupLink")->add($images_group_link);
// }
// }
// //点评评分分组
// $point_group = $_REQUEST['point_group'];
// foreach($point_group as $group_id)
// {
// if($group_id>0)
// {
// $point_group_link['point_group_id'] = intval($group_id);
// $point_group_link['category_id'] = intval($list);
// M("PointGroupLink")->add($point_group_link);
// }
// }
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
示例15: check_forms
function check_forms($data)
{
if (!check_empty($data)) {
return array('passed' => false, "error" => "empty ");
}
if (!check_phone($data["phone_num"])) {
return array('passed' => false, "error" => "phone_num");
}
if (!check_is_num($data["empiid"])) {
return array('passed' => false, "error" => "empiid");
}
if (!check_ferpa($data["ferpa_score"])) {
return array('passed' => false, "error" => "ferpa");
}
return array('passed' => true, "error" => '');
}