本文整理汇总了PHP中strim函数的典型用法代码示例。如果您正苦于以下问题:PHP strim函数的具体用法?PHP strim怎么用?PHP strim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$root = array();
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$GLOBALS['user_info'] = $user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$home_uid = intval($GLOBALS['request']['uid']);
$home_user_info_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $home_uid . " and is_effect = 1 and is_delete = 0");
if (!$home_user_info_data) {
$root['info'] = "非法的会员";
output($root);
}
$user_info['uid'] = $user_data['id'];
$user_info['email'] = $user_data['email'];
$user_info['user_name'] = $user_data['user_name'];
$user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
$root['user'] = $user_info;
$home_user_info['uid'] = $home_user_info_data['id'];
$home_user_info['email'] = $home_user_info_data['email'];
$home_user_info['user_name'] = $home_user_info_data['user_name'];
$home_user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($home_user_info_data['id'], "big"));
$home_user_info['fans'] = $home_user_info_data['focused_count'];
$home_user_info['follows'] = $home_user_info_data['focus_count'];
$home_user_info['photos'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_image where user_id = " . $home_user_info_data['id']);
$home_user_info['favs'] = $GLOBALS['db']->getOne("select sum(fav_count) from " . DB_PREFIX . "topic where user_id = " . $home_user_info_data['id']);
$root['home_user'] = $home_user_info;
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
$follow_list = $GLOBALS['db']->getAll("select focused_user_id as id,focused_user_name as user_name from " . DB_PREFIX . "user_focus where focus_user_id = " . $home_user_info_data['id'] . " order by id desc limit " . $limit);
$total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_focus where focus_user_id = " . $home_user_info_data['id']);
$follows = array();
foreach ($follow_list as $k => $v) {
$follows[$k]['uid'] = $v['id'];
$follows[$k]['user_name'] = $v['user_name'];
$follows[$k]['fans'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_focus where focused_user_id = " . $v['id']);
$follows[$k]['user_avatar'] = get_abs_img_root(get_muser_avatar($v['id'], "big"));
if ($v['id'] == $user_data['id']) {
$follows[$k]['is_follow'] = -1;
} else {
$focus_uid = intval($v['id']);
$focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_info['uid'] . " and focused_user_id = " . $focus_uid);
if ($focus_data) {
$follows[$k]['is_follow'] = 1;
} else {
$follows[$k]['is_follow'] = 0;
}
}
}
$root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
$root['item'] = $follows;
$root['return'] = 1;
$root['status'] = 1;
output($root);
}
示例2: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$dltid = intval($GLOBALS['request']['dltid']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$GLOBALS['db']->query("UPDATE " . DB_PREFIX . "deal_load_transfer SET status=0,callback_count = callback_count+1 where id=" . $dltid . " AND t_user_id=0 and user_id = " . $user_id);
if ($GLOBALS['db']->affected_rows()) {
$root['response_code'] = 1;
$root['show_err'] = "撤销操作成功";
} else {
$root['response_code'] = 0;
$root['show_err'] = "撤销操作失败";
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例3: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$page = intval($GLOBALS['request']['page']);
$status = strim($GLOBALS['request']['status']);
//0:全部;1:可转让;2:转让中;3:已转让;4:已撤销;
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/uc_func.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$result = getUcTransferBuys($page, $status);
$root['item'] = $result['list'];
$root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("DEAL_PAGE_SIZE")));
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例4: index
public function index()
{
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
if (app_conf("SMS_ON") == 0) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
//短信未开启
output($root);
}
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$root['user_id'] = $user_id;
if ($user_id > 0) {
$mobile = $user['mobile'];
$code = intval($user['bind_verify']);
if ($mobile == '') {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
output($root);
}
if (!check_mobile($mobile)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
output($root);
}
if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
//短信发送太快
output($root);
}
//开始生成手机验证
if ($code == 0) {
//已经生成过了,则使用旧的验证码;反之生成一个新的
$code = rand(1111, 9999);
$GLOBALS['db']->query("update " . DB_PREFIX . "user set bind_verify = '" . $code . "',verify_create_time = '" . TIME_UTC . "' where id = " . $user_id);
}
//使用立即发送方式
$result = send_verify_sms($mobile, $code, $user, true);
//
$root['response_code'] = $result['status'];
if ($root['response_code'] == 1) {
$root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
} else {
$root['show_err'] = $result['msg'];
if ($root['show_err'] == null || $root['show_err'] == '') {
$root['show_err'] = "验证码发送失败";
}
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例5: index
public function index()
{
if (strim($_REQUEST['order_sn']) != '') {
$condition['order_id'] = M("DealOrder")->where("order_sn='" . strim($_REQUEST['order_sn']) . "'")->getField("id");
}
if (strim($_REQUEST['notice_sn']) != '') {
$condition['notice_sn'] = $_REQUEST['notice_sn'];
}
if (strim($_REQUEST['user_name']) != '') {
$condition['user_id'] = M("User")->where("user_name='" . strim($_REQUEST['user_name']) . "'")->getField("id");
}
if (strim($_REQUEST['begin_time']) != '') {
$start_time = strtotime($_REQUEST['begin_time'] . ' 00:00:00');
$end_time = strtotime($_REQUEST['begin_time'] . ' 23:59:59');
$condition['s_create_time'] = $start_time;
//开始时间
$condition['e_create_time'] = $end_time;
//结束时间
}
$condition['is_payment_list'] = 1;
if (intval($_REQUEST['payment_id']) == 0) {
unset($_REQUEST['payment_id']);
}
$this->assign("default_map", $condition);
$this->assign("payment_list", M("Payment")->findAll());
parent::index();
}
示例6: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$root['page_title'] = "发起项目";
$region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc");
//二级地址
$root['region_lv2'] = $region_lv2;
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
$root['cate_list'] = $cate_list;
$deal_image = es_session::get("deal_image");
$root['deal_image'] = $deal_image;
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例7: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['biz_email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['biz_pwd']);
//密码
//检查用户,用户密码
$biz_user = biz_check($email, $pwd);
$supplier_id = intval($biz_user['supplier_id']);
$deal_id = intval($GLOBALS['request']['deal_id']);
//团购商品id
if ($supplier_id > 0) {
$root['user_login_status'] = 1;
//用户登陆状态:1:成功登陆;0:未成功登陆
$sql = "update " . DB_PREFIX . "message set is_read = 1 where is_read = 0 and rel_id = " . $deal_id . " and rel_table = 'deal' and pid = 0 and is_buy = 1";
//$root['sql'] = $sql;
$GLOBALS['db']->query($sql);
$root['return'] = 1;
} else {
$root['return'] = 0;
$root['user_login_status'] = 0;
//用户登陆状态:1:成功登陆;0:未成功登陆
$root['info'] = "商户不存在或密码错误";
}
output($root);
}
示例8: save_info
public function save_info()
{
$data = array();
$ajax = intval($_REQUEST['ajax']);
$data['user_name'] = strim($_REQUEST['user_name']);
if (empty($data['user_name'])) {
showErr("请填写您的姓名", $ajax);
}
$data['tel'] = strim($_REQUEST['tel']);
if (empty($data['tel'])) {
showErr("请填写您的联系方式", $ajax);
}
$data['content'] = strim($_REQUEST['content']);
if (empty($data['content'])) {
showErr("请填写您的留言内容", $ajax);
}
$data['cate_id'] = intval($_REQUEST['cate_id']);
$data['create_time'] = NOW_TIME;
$data['user_id'] = intval($_REQUEST['user_id']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $data, "INSERT", "", "SILENT");
$message_id = $GLOBALS['db']->insert_id();
if ($message_id > 0) {
showSuccess("申请成功!", $ajax, url_wap("index"));
} else {
showErr("发送失败,请重新申请!", $ajax);
}
}
示例9: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$root['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_collect WHERE deal_id = " . $id . " AND user_id=" . $user_id);
$root['user_money'] = $user['money'];
$root['user_money_format'] = format_price($user['money']);
//用户金额
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例10: index
public function index()
{
$order_sn = strim($_REQUEST['order_sn']);
$time = isset($_REQUEST['time']) ? to_date(to_timespan($_REQUEST['time'], "Y-m-d"), "Y-m-d") : "";
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
$condition = " 1=1 ";
if ($order_sn != "") {
$condition .= " and go.order_sn = '" . $order_sn . "' ";
}
if ($time != "") {
$condition .= " and go.ex_date = '" . $time . "' ";
$GLOBALS['tmpl']->assign('time', $time);
}
$user_id = $GLOBALS['user_info']['id'];
$result = get_order($limit, $user_id, $condition);
$page = new Page($result['count'], app_conf("PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("order_sn", $order_sn);
$GLOBALS['tmpl']->assign("order_info", $result['list']);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_goods_order.html");
$GLOBALS['tmpl']->display("page/uc.html");
}
示例11: show
public function show()
{
//获得文章列表
$artilce_cate = load_auto_cache("article_cates");
foreach ($artilce_cate as $k => $v) {
$artilce_cate[$k]['cate_id'] = $v['id'];
$artilce_cate[$k]['titles'] = $v['title'];
if ($id > 0 && $v['id'] == $id) {
$type_id = intval($v['type_id']);
$cate_name = $v['title'];
}
if ($id == $artilce_cate[$k]['cate_id']) {
$artilce_cate[$k]['current'] = 1;
}
}
$GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate);
//文章头部导航
$nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action']);
$GLOBALS['tmpl']->assign('nav_top', $nav_top);
$GLOBALS['tmpl']->assign('deal_type', 'article_type');
$act = strim($_REQUEST['act']);
$help_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "help where type = '" . $act . "' or id = " . intval($act));
$GLOBALS['tmpl']->assign("help_item", $help_item);
$GLOBALS['tmpl']->assign("page_title", $help_item['title']);
$GLOBALS['tmpl']->display("help_show.html");
}
示例12: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$user_names = preg_split("/[ ,]/i", $data['user_names']);
$user_ids = array();
foreach ($user_names as $k => $v) {
$uid = M("User")->where("user_name = '" . $v . "'")->getField("id");
if ($uid) {
$user_ids[] = str_pad($uid, 6, 0, STR_PAD_LEFT);
}
}
$data['user_ids'] = implode(",", $user_ids);
$data['end_time'] = strim($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['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"));
}
}
示例13: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
if ($page == 0) {
$page = 1;
}
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
$event_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_event order by sort desc limit " . $limit);
$count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_event");
foreach ($event_list as $k => $v) {
$now = get_gmtime();
$event_list[$k]['end_time'] = $v['event_end_time'];
$event_list[$k]['url'] = url("shop", "deal_event#show", array("id" => $v['id']));
$event_list[$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d');
$event_list[$k]['icon'] = get_abs_img_root(make_img($v['icon'], 592, 215, 1));
$event_list[$k]['sheng_time_format'] = to_date($v['event_end_time'] - $now, "d天h小时i分");
}
$page_total = ceil($count / $page_size);
$root = array();
$root['return'] = 1;
$root['item'] = $event_list;
$root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
$root['page_title'] = "活动专题";
$root['city_name'] = $city_name;
output($root);
}
示例14: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/deal.php';
$root['user_login_status'] = 1;
$result = getUCInrepayRepayBorrowMoney($id);
$root['status'] = $result['status'];
if ($result['status'] == 2) {
$root['response_code'] = 1;
$root['app_url'] = $result['jump'];
} else {
$root['response_code'] = $result['status'];
$root['show_err'] = $result['show_err'];
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例15: index
public function index()
{
$root = array();
$root['return'] = 1;
$page = intval($GLOBALS['request']['page']);
//分页
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$page = $page == 0 ? 1 : $page;
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
//检查用户,用户密码
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
$url = get_domain() . APP_ROOT;
$share_url = str_replace("sjmapi", "wap", $url);
if ($user_id) {
$share_url .= "?r=" . base64_encode(intval($user_id));
}
$root['share_url'] = $share_url;
$root['city_name'] = $city_name;
$root['page_title'] = "邀请链接";
//fwb 2014-08-27
output($root);
}