本文整理汇总了PHP中B函数的典型用法代码示例。如果您正苦于以下问题:PHP B函数的具体用法?PHP B怎么用?PHP B使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了B函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initialize
protected function _initialize()
{
// 获取当前用户ID
if (defined('UID')) {
return;
}
define('UID', is_login());
if (!UID) {
// 还没登录 跳转到登录页面
$this->redirect('Public/login');
}
// js,css的版本
if (APP_DEBUG) {
defined('SITE_VERSION') or define('SITE_VERSION', time());
} else {
defined('SITE_VERSION') or define('SITE_VERSION', C('SYSTEM_UPDATRE_VERSION'));
}
//加载权限控制类
B('Admin\\Behavior\\AuthCheck');
//导航
$top = get_top_menu_name(CONTROLLER_NAME);
$this->assign('topMenu', $top);
//菜单
$this->assign('menus', dynamicMenu($top['id'], $top['pid']));
}
示例2: 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"));
}
}
示例3: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("mail_server");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['smtp_server'])) {
$this->error(L("SMTP_SERVER_EMPTY_TIP"));
}
if (!check_empty($data['smtp_name'])) {
$this->error(L("SMTP_NAME_EMPTY_TIP"));
}
if (!check_empty($data['smtp_pwd'])) {
$this->error(L("SMTP_PWD_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"));
}
}
示例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("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"));
}
}
示例5: insert
public function insert()
{
B('FilterString');
$data = M("TagGroup")->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("TAGNAME_EMPTY_TIP"));
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//成功提示
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'] = $list;
M("TagGroupLink")->add($link_data);
}
}
clear_auto_cache("store_filter_nav_cache");
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"));
}
}
示例6: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = $data['id'] . l("TOPIC_DATA");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
rm_auto_cache("recommend_forum_topic");
M("TopicCateLink")->where("topic_id=" . $data['id'])->delete();
foreach ($_REQUEST['cate_id'] as $cate_id) {
$link_data = array();
$link_data['cate_id'] = $cate_id;
$link_data['topic_id'] = $data['id'];
M("TopicCateLink")->add($link_data);
}
syn_topic_match($data['id']);
//成功提示
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: 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"));
}
}
示例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("USER_GROUP_NAME_EMPTY_TIP"));
}
if ($data['discount'] <= 0 || $data['discount'] > 1) {
$data['discount'] = 1;
}
// 更新数据
$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);
}
}
示例9: insert
public function insert()
{
B('FilterString');
$data = M("PointGroup")->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("POINTNAME_EMPTY_TIP"));
}
if (M(MODULE_NAME)->where("`name`='" . $data['name'] . "'")->count() > 0) {
$this->error(L("HAD_POINTGROUP"));
}
// 更新数据
$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"));
}
}
示例10: 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"));
}
}
示例11: 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"));
}
}
示例12: 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("BRAND_NAME_EMPTY_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("Deal")->where("brand_id=" . $data['id'] . " and brand_promote = 1")->setField("begin_time", $data['begin_time']);
M("Deal")->where("brand_id=" . $data['id'] . " and brand_promote = 1")->setField("end_time", $data['end_time']);
//成功提示
syn_brand_status($data['id']);
clear_auto_cache("static_goods_info");
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"));
}
}
示例13: run
public function run(&$params)
{
$ccmService = service('CouponCodeMall');
$ccmService->clearCache($params['id']);
$params = null;
B('CouponCodeMallRecs', $params);
}
示例14: _initialize
public function _initialize()
{
$action = array('permission' => array(), 'allow' => array('changecontent', 'listdialog', 'revert', 'adddialog', 'analytics', 'checkout', 'getmonthlyreceive', 'getyearreceivecomparison', 'getreceivablesmoney', 'getpayablesmoney'));
B('Authenticate', $action);
$this->type = trim($_GET['t']) ? trim($_GET['t']) : 'receivables';
if (!in_array($this->type, array('receivables', 'payables', 'receivingorder', 'paymentorder'))) {
alert('error', L('PARAMETER_ERROR'), U('index/index'));
}
}
示例15: _initialize
public function _initialize()
{
$action = array();
B('Admin\\Behaviors\\Authenticate', '', $action);
//获取栏目信息
if (!($this->categorys = F('category_content'))) {
D('ArticleCategory')->file_cache();
$this->categorys = F('category_content');
}
}