当前位置: 首页>>代码示例>>PHP>>正文


PHP msubstr函数代码示例

本文整理汇总了PHP中msubstr函数的典型用法代码示例。如果您正苦于以下问题:PHP msubstr函数的具体用法?PHP msubstr怎么用?PHP msubstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了msubstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 public function edit($responseinfo)
 {
     //Api配置参数
     $res = unserialize($responseinfo['response_compos']);
     $config = '';
     foreach ($res['replace'] as $key => $value) {
         if (!empty($value)) {
             $config .= $key . ':' . $value . "\n";
         }
     }
     $res['config'] = $config;
     //Api插件模块  第三方接口
     if ($res['type'] == 'cloud') {
         $cloudlist = M('webuntil')->where(array('status' => 1))->field('id,webuntil_type,webuntil_name,webuntil_backtype,webuntil_title')->select();
         $locallist = array();
         foreach ($cloudlist as $key => $value) {
             $locallist[$key] = array('id' => $value['id'], 'title' => $value['webuntil_name'], 'name' => " 请求" . $value['webuntil_type'], 'description' => "回复" . $value['webuntil_backtype']);
         }
     } else {
         $locallist = M('Addons')->where(array('status' => 1, 'weixin' => 1))->field('id,title,name,description,config')->select();
         foreach ($locallist as $key => $value) {
             $locallist[$key]['description'] = msubstr($value['description'], 0, 25, $charset = "utf-8", $suffix = true);
         }
     }
     $res['localapi'] = $locallist;
     return $res;
 }
开发者ID:fedkey,项目名称:amango,代码行数:27,代码来源:ApiFactory.class.php

示例2: get_payment_code

 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     $sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']);
     $title_name = $GLOBALS['db']->getOne($sql);
     $subject = msubstr($title_name, 0, 40);
     $data_return_url = SITE_DOMAIN . APP_ROOT . '/index.php.php?ctl=payment&act=response&class_name=Wtenpay';
     $notify_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Wtenpay';
     $pay = array();
     $pay['subject'] = $subject;
     $pay['body'] = $title_name;
     $pay['total_fee'] = $money;
     $pay['total_fee_format'] = format_price($money);
     $pay['out_trade_no'] = $payment_notice['notice_sn'];
     $pay['notify_url'] = $notify_url;
     $pay['partner'] = $payment_info['config']['tenpay_partner'];
     //合作商户ID
     $pay['key'] = $payment_info['config']['tenpay_key'];
     //支付宝(RSA)公钥
     $pay['pay_code'] = 'wtenpay';
     //,支付宝;mtenpay,财付通;mcod,货到付款
     return $pay;
 }
开发者ID:macall,项目名称:jsd,代码行数:26,代码来源:Wtenpay_payment.php

示例3: update

 public function update()
 {
     $id = $_REQUEST['id'];
     $title = $_REQUEST['title'];
     if (!empty($id)) {
         $data = $_POST;
         if (!empty($title)) {
             $data['title'] = $title;
         }
         if (empty($_POST['brief'])) {
             //                import("@.ORG.Validation");
             //                $v = new Validation();
             //                $description = $v->kill_html($_POST['description']);
             $description = strip_tags($_POST['description']);
             $data['brief'] = msubstr(trim($description), 0, 120);
         }
         $data['id'] = $id;
         $model = $this->getActionName();
         $case = M($model);
         // 更新数据
         $list = $case->save($data);
         if (false !== $list) {
             $this->assign('jumpUrl', U("News/"));
             $this->success('编辑成功!');
         } else {
             //错误提示
             $this->error('编辑失败!');
         }
     } else {
         //错误提示
         $this->error('编辑失败!');
     }
 }
开发者ID:ycltpe,项目名称:sig,代码行数:33,代码来源:NewsAction.class.php

示例4: load_msg

 /**
  * 加载相应的类型消息
  * @param unknown_type $msg  数据集(即数据库中的对应消息行)
  *
  * 返回:array("id"=>"当前消息ID",title="标题",is_read=>"是否已读","icon"=>"相关数据的图片(可为空)","content"=>"内容","create_time"=>"时间","link"=>"(可为空)相关数据的跳转链接");
  */
 public function load_msg($msg)
 {
     if (!$msg['data']) {
         require_once APP_ROOT_PATH . "system/model/topic.php";
         $data = get_topic_item($msg['data_id']);
         $msg['data'] = serialize($data);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg, "UPDATE", "id=" . $msg['id'], "SILENT");
     }
     $data = unserialize($msg['data']);
     //图标,取分享的第一张
     if ($data['id'] != $data['origin_id'] && $data['origin']) {
         $msg['title'] = $data['origin']['forum_title'];
         $msg['icon'] = $data['origin']['images'][0]['o_path'];
         $msg['link'] = $data['origin']['url'];
     } else {
         $msg['title'] = $data['forum_title'];
         $msg['icon'] = $data['images'][0]['o_path'];
         $msg['link'] = $data['url'];
     }
     if ($msg['title'] == "") {
         $msg['title'] = "会员分享";
     }
     $msg['short_title'] = msubstr($msg['title']);
     return $msg;
 }
开发者ID:macall,项目名称:jsd,代码行数:31,代码来源:topic_msg.php

示例5: dailyList

 /**
  * @author Knight
  * @cnname 我的文章列表
  */
 public function dailyList()
 {
     $where = "status=1 and permission=1";
     $typeId = I("id");
     //日子类别Id
     if (!empty($typeId)) {
         $where .= " and type=" . $typeId;
     }
     $count = M("daily")->where($where)->count();
     $page = new \Think\Page($count, 5);
     $show = $page->show();
     $dailyList = M("daily")->where($where)->order("c_time desc")->limit($Page->firstRow . ',' . $page->listRows)->select();
     foreach ($dailyList as $k => $v) {
         $where = "id=" . $v['type'];
         $typeName = $this->getInfo("daily_type", array("type_name"), $where);
         $dailyList[$k]['typeName'] = $typeName[0]['type_name'];
         $dailyList[$k]['c_time'] = date("Y-m-d", $v['c_time']);
         $dailyList[$k]['content'] = msubstr(filterHtml($v['content']), 0, 100, "utf-8");
     }
     $pageList = $page->show();
     $this->assign('type', 1);
     $this->assign("pageList", $pageList);
     //分页数据
     $this->assign("pageTotal", $page->totalPages);
     //分页总数
     $this->assign("dailyList", $dailyList);
     $this->display("Index/newList");
 }
开发者ID:knight-chen,项目名称:myblog,代码行数:32,代码来源:IndexController.class.php

示例6: add

 public function add()
 {
     if (!$GLOBALS['islogin']) {
         exit;
     }
     if (!checkpost()) {
         exit;
     }
     $diary = M('diary');
     $uid = $GLOBALS['i']['uid'];
     $data['uid'] = $GLOBALS['i']['uid'];
     $content = postvar('content');
     $data['original_cont'] = exp_content($content);
     $content = msubstr($content, 0, 100, 'utf-8', false);
     $data['content'] = exp_content($content);
     $data['mood'] = postvar('mood');
     $data['read_type'] = postvar('read_type', 1);
     $data['add_time'] = time();
     $data['set_time'] = strtotime(postvar('set_time'));
     $did = $diary->add($data);
     //echo $diary->getLastSql();
     $member_field = M('member_field');
     $data1['diary_num'] = array('exp', 'diary_num+1');
     $member_field->where("uid={$uid}")->save($data1);
     $body = array('did' => $did, 'content' => $data['content']);
     //feed_publish(1, $body, $did);
     $feedModel = D('Feed');
     $feedModel->feed_publish(1, $body, $did);
     echo '{"errno":200}';
 }
开发者ID:laiello,项目名称:qinhan,代码行数:30,代码来源:DiaryAction.class.php

示例7: get_user_withdraw

function get_user_withdraw($limit, $user_id)
{
    $user_id = intval($user_id);
    $list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "withdraw where user_id = " . $user_id . " and is_delete = 0 order by create_time desc limit " . $limit);
    foreach ($list as $k => $v) {
        $bank_account_end = substr($v['bank_account'], -4, 4);
        $bank_account_show_length = strlen($v['bank_account']) - 4;
        $bank_account = "";
        for ($i = 0; $i < $bank_account_show_length; $i++) {
            $bank_account .= "*";
        }
        $bank_account .= $bank_account_end;
        $list[$k]['bank_account'] = $bank_account;
        $bank_user_end = msubstr($v['bank_user'], -1, 1, "utf-8", false);
        $bank_user_show_length = mb_strlen($v['bank_user'], "utf-8") - 1;
        $bank_user = "";
        for ($i = 0; $i < $bank_user_show_length; $i++) {
            $bank_user .= "*";
        }
        $bank_user .= $bank_user_end;
        $list[$k]['bank_user'] = $bank_user;
    }
    $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "withdraw where user_id = " . $user_id . " and is_delete = 0");
    return array("list" => $list, 'count' => $count);
}
开发者ID:macall,项目名称:jsd,代码行数:25,代码来源:user_center.php

示例8: get_payment_code

 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     $sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']);
     $title_name = $GLOBALS['db']->getOne($sql);
     $subject = msubstr($title_name, 0, 40);
     //$data_return_url = get_domain().APP_ROOT.'/../payment.php?act=return&class_name=Malipay';
     $notify_url = get_domain() . APP_ROOT . '/../shop.php?ctl=payment&act=response&class_name=Malipay';
     $pay = array();
     $pay['subject'] = $subject;
     $pay['body'] = $title_name;
     $pay['total_fee'] = $money;
     $pay['total_fee_format'] = format_price($money);
     $pay['out_trade_no'] = $payment_notice['notice_sn'];
     $pay['notify_url'] = $notify_url;
     $pay['partner'] = $payment_info['config']['alipay_partner'];
     //合作商户ID
     $pay['seller'] = $payment_info['config']['alipay_account'];
     //账户ID
     $pay['rsa_alipay_public'] = $payment_info['config']['alipay_rsa_public'];
     //支付宝(RSA)公钥
     $pay['pay_code'] = 'malipay';
     //,支付宝;mtenpay,财付通;mcod,货到付款
     $order_spec = '';
     $order_spec .= 'partner="' . $pay['partner'] . '"';
     //合作商户ID
     $order_spec .= '&seller="' . $pay['seller'] . '"';
     //账户ID
     $order_spec .= '&out_trade_no="' . $pay['out_trade_no'] . '"';
     $order_spec .= '&subject="' . $pay['subject'] . '"';
     $order_spec .= '&body="' . $pay['body'] . '"';
     $order_spec .= '&total_fee="' . $pay['total_fee'] . '"';
     $order_spec .= '&notify_url="' . $pay['notify_url'] . '"';
     $pay['order_spec'] = $order_spec;
     $sign = $this->sign($order_spec);
     $pay['sign'] = urlencode($sign);
     $pay['sign_type'] = 'RSA';
     /*
     $pubkey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC6IQ/HH06GbTIhKNN/YSQXxllnP7cNERMuN16GgZDfuf9NrY/Bw2ZINkq1RMNlbP66Vu5y0gwYPC/7PbO5l6pbnl3N4rw5VY3U6rtIC0f8ADDLrIZwShYUitaFq+Ao7rhk/GbpfSD7vgnugQz74fVewi17S3Apujq4U4LAxFmVowIDAQAB';
     $pubkey = $this->getPublicKeyFromX509($pubkey);
     
     $res = openssl_pkey_get_public($pubkey);		
     $sign = base64_decode($sign);
     $verify = openssl_verify($order_spec, $sign, $res);
     if ($verify == 1)
     {
     	$pay['openssl_verify'] = 'ok';
     }else{
     	$pay['openssl_verify'] = 'error';
     }		
     */
     //
     //		print_r($payment_info['config']);
     //		print_r($pay);exit;
     return $pay;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:59,代码来源:Malipay_payment.php

示例9: content

 public function content()
 {
     $id = I('id');
     $map['id'] = $id;
     $info = D('Material')->_get($map);
     $this->assign('vo', $info);
     $this->assign('header_title', msubstr($info['title'], 0, 19));
     $this->display();
 }
开发者ID:a3147972,项目名称:micro_business,代码行数:9,代码来源:MaterialController.class.php

示例10: auto_desc

 protected function auto_desc()
 {
     $desc = I('post.desc', '');
     if (!empty($desc)) {
         return $desc;
     }
     $content = strip_tags(I('post.content'));
     $desc = msubstr($content, 0, 200);
     return $desc;
 }
开发者ID:a3147972,项目名称:blog,代码行数:10,代码来源:ArticleModel.class.php

示例11: index

 public function index($type = 'inbox')
 {
     $dao = model('Message');
     $list = $type == 'inbox' ? $dao->getInboxByUid($this->mid) : $dao->getOutboxByUid($this->mid);
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['summary'] = msubstr($v['content'], 0, 100);
     }
     $this->assign($list);
     $session_count = $dao->getSessionCount($this->mid, getSubByKey($list['data'], 'source_message_id'));
     $this->assign('session_count', $session_count);
     $this->assign('type', $type);
     $this->display('list');
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:13,代码来源:MessageAction.class.php

示例12: category

 public function category($category_id = 0)
 {
     $map['category'] = $category_id;
     $map['status'] = 1;
     $questionModel = new QuestionModel();
     $hot_list = $questionModel->getList($map, '*', 5, 'answer_num desc');
     foreach ($hot_list as &$val) {
         $val['info'] = msubstr(op_t($val['description']), 0, 50);
     }
     unset($val);
     $this->assign('hot_list', $hot_list);
     $this->display(T('Application://Question@Widget/category'));
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:13,代码来源:RightBlockWidget.class.php

示例13: getLists

 /**
  * 获取收藏列表
  * @param  int $uid 用户uid
  */
 public function getLists($uid)
 {
     $map = array('user_id' => $uid);
     $lists = $this->where($map)->select();
     $product = array();
     foreach ($lists as $key => $value) {
         $product = M('FxProduct')->field('product_name, thumb')->where(array('product_id' => $value['product']))->find();
         $lists[$key]['title'] = msubstr($product['product_name'], 0, 15);
         $lists[$key]['thumb'] = thumb($product['thumb']);
         $lists[$key]['url'] = U('Index/product', array('id' => $value['product']));
         $lists[$key]['del_url'] = U('collect', array('type' => 2, 'product_id' => $value['product']));
     }
     return $lists;
 }
开发者ID:wuwenbao,项目名称:paimai,代码行数:18,代码来源:FxProductCollectModel.class.php

示例14: load_msg

 /**
  * 加载相应的类型消息
  * @param unknown_type $msg  数据集(即数据库中的对应消息行)
  *
  * 返回:array("id"=>"当前消息ID",title="标题",is_read=>"是否已读","icon"=>"相关数据的图片(可为空)","content"=>"内容","create_time"=>"时间","link"=>"(可为空)相关数据的跳转链接");
  */
 public function load_msg($msg)
 {
     if (!$msg['data']) {
         $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $msg['data_id']);
         $msg['data'] = serialize($data);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg, "UPDATE", "id=" . $msg['id'], "SILENT");
     }
     $data = unserialize($msg['data']);
     $msg['title'] = $data['name'];
     $msg['icon'] = $data['deal_icon'];
     $msg['link'] = url("index", "uc_order#view", array("id" => $data['order_id']));
     $msg['short_title'] = msubstr($msg['title']);
     return $msg;
 }
开发者ID:macall,项目名称:jsd,代码行数:20,代码来源:orderitem_msg.php

示例15: newslist

 /**
  * 页面列表
  */
 public function newslist()
 {
     $_REQUEST['tabHash'] = 'newslist';
     //按钮
     //$this->pageButton[] = array('uid','title'=>'搜索', 'onclick'=>"admin.fold('search_form')");
     $this->pageButton[] = array('uid', 'title' => '删除', 'onclick' => "admin.deleteInfo();");
     $this->pageButton[] = array('uid', 'title' => '添加资讯', 'onclick' => "location.href='" . U('news/admin/setinfo', array('tabHash' => 'newslist')) . "';");
     //处理分类HASH
     $cs = model('CategoryTree')->setTable('news_category')->getCategoryList();
     $categorys = array();
     foreach ($cs as $ct) {
         $categorys[$ct['news_category_id']] = $ct;
     }
     //构造搜索条件
     //列表key值 DOACTION表示操作
     $this->pageKeyList = array('image', 'news_title', 'news_content', 'state', 'is_top', 'hits', 'date', 'DOACTION');
     $listData = M('News')->order('news_id desc')->findPage(15);
     foreach ($listData['data'] as $key => $val) {
         $listData['data'][$key]['id'] = $val['news_id'];
         $thumb = APPS_URL . '/' . APP_NAME . '/_static/nopic.jpg';
         if ($val['image']) {
             $attach = model('Attach')->getAttachById($val['image']);
             if ($attach) {
                 $thumb = getImageUrl($attach['save_path'] . $attach['save_name'], 100, 100, true);
             }
         }
         //获取分类
         $type_str = '';
         if ($val['type_id']) {
             if (isset($categorys[$val['type_id']])) {
                 $type_str .= $categorys[$val['type_id']]['title'];
                 if (isset($categorys[$categorys[$val['type_id']]['pid']])) {
                     $type_str = $categorys[$categorys[$val['type_id']]['pid']]['title'] . '--' . $type_str;
                 }
             }
         }
         $listData['data'][$key]['image'] = '<img src="' . $thumb . '">';
         $listData['data'][$key]['news_title'] = msubstr($val['news_title'], 0, 20) . "<BR><BR><font style='color:#7d7d7d;'>分类: " . $type_str . "</font>";
         $listData['data'][$key]['news_content'] = msubstr(strip_tags($val['news_content']), 0, 20);
         $listData['data'][$key]['state'] = D('News')->getState($val['state']);
         $listData['data'][$key]['date'] = '创建:' . date('m/d G:i', $val['created']);
         if ($val['updated']) {
             $listData['data'][$key]['date'] .= '<br>更新:' . date('m/d G:i', $val['updated']);
         }
         $listData['data'][$key]['is_top'] = $val['is_top'] ? '<font color="red">置顶</font>' : '否';
         $listData['data'][$key]['DOACTION'] = '<a href="' . U('news/admin/setinfo', array('news_id' => $val['news_id'], 'tabHash' => 'setinfo')) . '">编辑</a>';
     }
     $this->displayList($listData);
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:52,代码来源:AdminAction.class.php


注:本文中的msubstr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。