本文整理匯總了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');
}
}