• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP str_len函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fix_avatars

 public function fix_avatars()
 {
     connect();
     $array = mysql_array("SELECT distinct md5(email), email from jq_comments");
     foreach ($array as $row) {
         $email = $row[1];
         $data = file_get_contents('http://www.gravatar.com/avatar/' . $row[0] . '.png?d=404&s=48');
         if ($data) {
             $avatar = "avatars/" . $row[0] . ".png";
             $file = fopen($avatar, "w");
             if (!$file) {
                 throw new Exception("IO Error: Can't open file {$avatar}");
             }
             fwrite($avatar, $data);
             fclose($file);
         } else {
             $avatar = "avatars/default.png";
         }
         $avatars[] = array($avatar, str_len($data));
         if (!mysql_query("UPDATE jq_comments set avatar = '{$avatar}' where email = '{$email}'")) {
             throw new Exception("Can't update {$row[1]}");
         }
     }
     return $avatars;
 }
开发者ID:jcubic,项目名称:jquery.terminal-www,代码行数:25,代码来源:service.php


示例2: checkCreatedOn

 /**
  * @author: 肖红阳
  * check created_on column
  * @param $attribute
  */
 public function checkCreatedOn($attribute, $params)
 {
     p($this->{$attribute});
     if (empty($this->{$attribute}) || str_len($this->{$attribute}) < 4 || is_null($this->{$attribute}) || !$this->{$attribute} > 0) {
         $this->addError($attribute, "created_on 错误!");
     } else {
         $this->setAttribute($attribute, $this->{$attribute});
     }
 }
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:14,代码来源:Test_student.php


示例3: get_ip

function get_ip()
{
    $ip = "UNBEKANNT";
    if (isset($_SERVER['HTTP_CLIENT_IP']) && str_len($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER["HTTP_CLIENT_IP"];
    } else {
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && str_len($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else {
            if ($_SERVER["REMOTE_ADDR"]) {
                $ip = $_SERVER["REMOTE_ADDR"];
            }
        }
    }
    return $ip;
}
开发者ID:batman,项目名称:rentashopper,代码行数:16,代码来源:functions.php


示例4: get_order_info

function get_order_info()
{
    $datetime = $_GET['datetime'];
    $order_sn = trim($_GET['order_sn']);
    $print_sn = trim($_GET['print_sn']);
    $where = "where i.country " . $GLOBALS['city_code'];
    if ($datetime) {
        $where .= " and l.bdate='" . $datetime . "'";
    }
    if ($print_sn) {
        $where .= " and l.print_sn='" . $print_sn . "'";
    }
    if ($order_sn) {
        if (str_len($order_sn) == 5) {
            $where .= " and i.order_sn like '%{$order_sn}'";
        } else {
            $where = "where i.country " . $GLOBALS['city_code'] . " and i.order_sn='" . $order_sn . "'";
        }
    }
    $sql = "SELECT i.order_sn,i.inv_payee,i.inv_content,i.postscript,i.money_address,i.scts,i.wsts,i.card_message,i.order_id, i.order_status, i.pay_status, i.orderman, i.consignee, i.add_time as time1, i.pay_name, i.best_time, i.province, i.address, g.remark, dis.status as sta1, dis.route_id, dis.turn, dis.add_time as time2, l.ptime, l.stime, l.print_sn,l.bdate, del.status as sta2, rou.route_code, s.station_name\r\n\tFROM ecs_order_info AS i\r\n\tLEFT JOIN order_genid AS g ON g.order_id = i.order_id\r\n\tLEFT JOIN order_dispatch AS dis ON dis.order_id = i.order_id\r\n\tLEFT JOIN print_log_x AS l ON l.order_id = dis.order_id \r\n\tLEFT JOIN order_delivery AS del ON del.order_id = i.order_id\r\n\tLEFT JOIN ship_route AS rou ON rou.route_id = dis.route_id\r\n\tLEFT JOIN ship_station AS s ON rou.station_id = s.station_id " . $where . " limit 1";
    $arr = $GLOBALS['db_read']->getRow($sql);
    if ($arr['order_id']) {
        $sql = "select goods_name,goods_attr,goods_number from ecs_order_goods as goo where order_id='" . $arr['order_id'] . "' and goods_attr!=''";
        $arr2 = $GLOBALS['db_read']->getAll($sql);
    } else {
        $arr2 = array();
    }
    foreach ($arr2 as $k => $v) {
        $arr2[$k]['goods_name'] = $v['goods_name'] . "--" . $v['goods_attr'] . "--" . $v['goods_number'];
        if ($k != 0) {
            $arr2[0]['goods_name'] .= " | " . $arr2[$k]['goods_name'];
        }
    }
    $sql = "select sum(goods_number) as c_num from ecs_order_goods as goo where order_id='" . $arr['order_id'] . "' and goods_id='60'";
    $c_arr = $GLOBALS['db_read']->getOne($sql);
    $sql = "select sum(goods_number) as l_num from ecs_order_goods as goo where order_id='" . $arr['order_id'] . "' and goods_id='61'";
    $l_arr = $GLOBALS['db_read']->getOne($sql);
    return array("order_info" => $arr, "goods_info" => $arr2, "cj" => $c_arr, "lz" => $l_arr);
}
开发者ID:songtaiwu,项目名称:mordercms,代码行数:39,代码来源:order_search.php


示例5: get_order_info

function get_order_info()
{
    $datetime = empty($_GET['datetime']) ? date("Y-m-d") : $_GET['datetime'];
    $order_sn = empty($_GET['order_sn']) ? "" : trim($_GET['order_sn']);
    $print_sn = empty($_GET['print_sn']) ? "" : trim($_GET['print_sn']);
    $where = "where i.country " . $GLOBALS['city_code'];
    if ($datetime) {
        $where .= " and l.bdate='" . $datetime . "'";
    }
    if ($print_sn) {
        $where .= " and l.print_sn='" . $print_sn . "' ";
    }
    if ($order_sn) {
        if (str_len($order_sn) == 5) {
            $where .= " and i.order_sn like '%{$order_sn}' ";
        } else {
            $where = "where i.order_sn='" . $order_sn . "'";
        }
    }
    $sql = "SELECT i.order_sn,i.order_id, i.best_time, l.ptime, l.stime, l.print_sn,bdate  \r\n\tFROM ecs_order_info AS i\r\n\tLEFT JOIN order_genid AS g ON g.order_id = i.order_id\r\n\tLEFT JOIN order_dispatch AS dis ON dis.order_id = i.order_id\r\n\tLEFT JOIN print_log_x AS l ON l.order_id = dis.order_id \r\n\tLEFT JOIN order_delivery AS del ON del.order_id = i.order_id\r\n\tLEFT JOIN ship_route AS rou ON rou.route_id = dis.route_id\r\n\tLEFT JOIN ship_station AS s ON rou.station_id = s.station_id " . $where . " limit 1";
    $arr = $GLOBALS['db_read']->getRow($sql);
    return $arr;
}
开发者ID:songtaiwu,项目名称:mordercms,代码行数:23,代码来源:order_check2.php


示例6: empty

     exit;
 case 'register':
     //更新数据库数据
     $sms_server_id = empty($_POST["sms_server_id"]) ? 0 : intval($_POST["sms_server_id"]);
     $user = trim($_POST["user"]);
     $pass = trim($_POST["pass"]);
     $server = trim($_POST["server"]);
     $port = trim($_POST["port"]);
     $total = empty($_POST["total"]) ? 0 : intval($_POST["total"]);
     $is_active = empty($_POST["is_active"]) ? 0 : intval($_POST["is_active"]);
     $phone = trim($_POST["phone"]);
     $sql = "update " . $ecs->table("sms_server") . " set user='{$user}',pass='{$pass}',server='{$server}',port='{$port}',is_active='{$is_active}',total='{$total}' where sms_server_id=" . $sms_server_id;
     $db->query($sql);
     $msg = "服务器设置成功!";
     //短信测试
     if ($is_active && str_len($phone) > 3) {
         $sms = new sms();
         $res = $sms->send($phone, "您好,您已开通您的短信服务,感谢您的使用!【磐盛科技】", "", "", $_SESSION["admin_name"]);
         if ($res['error'] == 1) {
             $msg .= $res['msg'];
         } else {
             $msg .= "请查收短信";
         }
     }
     sys_msg($msg, 0, array(), false);
     exit;
 case 'sense':
     $smarty->assign('ur_here', "敏感词汇");
     $sms = new sms();
     $smarty->assign('sense', implode("|", $sms->sense));
     assign_query_info();
开发者ID:dalinhuang,项目名称:hteacher,代码行数:31,代码来源:sms.php


示例7: create_menu

    public function create_menu($db)
    {
        $this->access_token($db);
        $ret = $db->getRow("SELECT `access_token` FROM `wxch_config`");
        $access_token = $ret['access_token'];
        if (strlen($access_token) == 150) {
            $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $access_token;
            $menu = '{
     "button":[
     {	
          "type":"click",
          "name":"新款推荐",
          "key":"XKTJ"
      },
      {
           "type":"click",
           "name":"绑定会员",
           "key":"BDHY"
      },
      {
           "name":"帮助",
           "sub_button":[
           {	
               "type":"click",
               "name":"订单查询",
               "key":"DDCX",
            },
            {
              "type":"click",
               "name":"快递查询",
               "key":"KDCX",
            },
            {
               "type":"click",
               "name":"帮助",
               "key":"HELP"
            }]
       }]
 }';
            $ret = $this->curl_grab_page($url, $menu);
            $errmsg = $ret->errmsg;
            if ($errmsg == 'ok') {
                echo '创建菜单成功';
            } else {
                $i = 1;
                $max = 100;
                for ($i; $i <= $max; $i++) {
                    sleep(1);
                    $ret_json = $this->curl_grab_page($url, $menu);
                    $ret = json_decode($ret_json);
                    if ($ret->errcode == 0) {
                        echo '尝试第' . $i . '时成功创建';
                        break;
                    }
                }
                if ($ret->errcode == -1) {
                    echo '尝试创建' . $i . '次菜单失败,请稍后再试';
                }
            }
            print_r($ret);
        } else {
            echo 'access_token:' . str_len($access_token);
        }
    }
开发者ID:YangZeSummer,项目名称:NanJingSecond-Hand,代码行数:64,代码来源:callback.php


示例8: linktipp_display

function linktipp_display($linktipp, $addclass = '')
{
    global $options;
    if (!isset($linktipp)) {
        return;
    }
    $post_id = isset($linktipp->ID) ? $linktipp->ID : 0;
    $title = get_the_title($linktipp);
    $linktipp_url = get_post_meta($post_id, 'linktipp_url', true);
    $linktipp_imgid = get_post_meta($post_id, 'linktipp_imgid', true);
    $linktipp_image = get_post_meta($post_id, 'linktipp_image', true);
    $linktipp_untertitel = get_post_meta($post_id, 'linktipp_untertitel', true);
    $linktipp_text = get_post_meta($post_id, 'linktipp_text', true);
    if (isset($linktipp_untertitel) && !isset($title)) {
        $title = $linktipp_untertitel;
        $linktipp_untertitel = '';
    }
    $out = '';
    $out .= '<section class="p3-column linktipps ' . $addclass . '" id="post-' . $post_id . '" >';
    $out .= "\n";
    if ($options['linktipps-titlepos'] != 1) {
        $out .= '<header class="post-title p3-cbox">';
        if (mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '<div class="hgroup">';
        }
        if ($options['linktipps-subtitlepos'] == 0 && mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        $out .= '<h2>';
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '<a href="' . $linktipp_url . '" rel="bookmark">';
        }
        $out .= $title;
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '</a>';
        }
        $out .= '</h2>';
        if ($options['linktipps-subtitlepos'] == 1 && mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        if (mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '</div>';
        }
        $out .= '</header>';
        $out .= "\n";
    }
    $out .= '<div class="p3-column">';
    $out .= "\n";
    $out .= '<article class="post-entry p3-cbox">';
    $out .= "\n";
    if ($options['linktipps-linkpos'] == 1) {
        $out .= '<a href="' . $linktipp_url . '">';
    }
    if (isset($linktipp_imgid) && $linktipp_imgid > 0) {
        $image_attributes = wp_get_attachment_image_src($linktipp_imgid, 'linktipp-thumb');
        if (is_array($image_attributes)) {
            $out .= '<img src="' . $image_attributes[0] . '" width="' . $image_attributes[1] . '" height="' . $image_attributes[2] . '" alt="' . trim(strip_tags($linktipp_text)) . '">';
        }
    } elseif (isset($linktipp_image)) {
        $out .= '<img src="' . $linktipp_image . '" alt="">';
    }
    if ($options['linktipps-linkpos'] == 1) {
        $out .= '</a>';
    }
    if (isset($linktipp_text)) {
        $out .= piratenkleider_make_nice_links($linktipp_text);
    }
    $out .= "</article>\n";
    if ($options['linktipps-titlepos'] == 1) {
        $out .= '<header class="post-title p3-cbox">';
        if (str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '<div class="hgroup">';
        }
        if ($options['linktipps-subtitlepos'] == 0 && str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        $out .= '<h2>';
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '<a href="' . $linktipp_url . '" rel="bookmark">';
        }
        $out .= $title;
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '</a>';
        }
        $out .= '</h2>';
        if ($options['linktipps-subtitlepos'] == 1 && str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        if (str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '</div>';
        }
        $out .= '</header>';
        $out .= "\n";
    }
    if ($options['linktipps-linkpos'] == 2 || $options['linktipps-linkpos'] == 3) {
        $out .= '<footer class="linktipp-url"><a class="extern" href="' . $linktipp_url . '">' . $linktipp_url . '</a></footer>';
    }
    $out .= "</div>\n";
    $out .= "</section>\n";
    return $out;
//.........这里部分代码省略.........
开发者ID:tierce,项目名称:Piratenkleider,代码行数:101,代码来源:custom-posts.php


示例9: search_smart_truncate

function search_smart_truncate($text, $len, $needles)
{
    if (is_array($needles) && count($needles)) {
        return truncatePreserveWords($text, $needles);
    } else {
        if (str_len($txt) > $len) {
            return word_limiter($text, $len);
        }
    }
}
开发者ID:e-gob,项目名称:ChileAtiende,代码行数:10,代码来源:MY_text_helper.php


示例10: str_len

<?php

$firstName = 'Andy';
$nameLength = str_len($firstName);
$myVar = 'Hi, my name is ' . $nameLength . ' letters long.';
echo $myVar;
开发者ID:piiskop,项目名称:pstk,代码行数:6,代码来源:lesson05b.php


示例11: create_menu

    public function create_menu($db)
    {
        $this->access_token($db);
        $ret = $db->getRow("SELECT `access_token` FROM `wxch_config`");
        $access_token = $ret['access_token'];
        if (strlen($access_token) == 150) {
            $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $access_token;
            //            $arr = array(
            //                'button' => array(
            //                    array('type'=>'click','name'=>'新款推荐','key'=>'XKTJ'),
            //                    array('type'=>'click','name'=>'绑定会员','key'=>'BDHY'),
            //                    array('name'=>'更多','sub_button'=>array(
            //                            array('type'=>'click','name'=>'订单查询','key'=>'DDCX'),
            //                            array('type'=>'click','name'=>'快递查询','key'=>'KDCX'),
            //                            array('type'=>'click','name'=>'帮助','key'=>'HELP')
            //                            )
            //                        )
            //                    )
            //            );
            //            $arr = mb_convert_encoding($arr, "GBK", "UTF-8");
            //            print_r($arr);exit;
            //            $menu = json_encode($arr);
            //            print_r($menu);exit;
            //
            $menu = '{
     "button":[
     {	
          "type":"click",
          "name":"新款推荐",
          "key":"XKTJ"
      },
      {
           "type":"click",
           "name":"绑定会员",
           "key":"BDHY"
      },
      {
           "name":"帮助",
           "sub_button":[
           {	
               "type":"click",
               "name":"订单查询",
               "key":"DDCX",
            },
            {
              "type":"click",
               "name":"快递查询",
               "key":"KDCX",
            },
            {
               "type":"click",
               "name":"帮助",
               "key":"HELP"
            }]
       }]
 }';
            //     print_r($menu);exit;
            //            $menu = mb_convert_encoding($menu, "UTF-8", "GBK");
            //            $menu_arr = json_decode($menu,TRUE);
            $ret = $this->curl_grab_page($url, $menu);
            $errmsg = $ret->errmsg;
            if ($errmsg == 'ok') {
                echo '创建菜单成功';
            } else {
                $i = 1;
                $max = 100;
                for ($i; $i <= $max; $i++) {
                    sleep(1);
                    $ret_json = $this->curl_grab_page($url, $menu);
                    $ret = json_decode($ret_json);
                    if ($ret->errcode == 0) {
                        echo '尝试第' . $i . '时成功创建';
                        break;
                    }
                }
                if ($ret->errcode == -1) {
                    echo '尝试创建' . $i . '次菜单失败,请稍后再试';
                }
            }
            print_r($ret);
        } else {
            echo 'access_token:' . str_len($access_token);
        }
    }
开发者ID:will0306,项目名称:bianli100,代码行数:84,代码来源:callback-ent.php


示例12: order_list

function order_list()
{
    $filter['sdate'] = empty($_REQUEST['sdate']) ? '' : trim($_REQUEST['sdate']);
    $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
    $filter['turn'] = empty($_REQUEST['turn']) ? 0 : intval($_REQUEST['turn']);
    $filter['station'] = empty($_REQUEST['station']) ? '' : intval($_REQUEST['station']);
    $filter['employee'] = empty($_REQUEST['employee']) ? '' : intval($_REQUEST['employee']);
    $filter['pack_no'] = empty($_REQUEST['pack_no']) ? '' : trim($_REQUEST['pack_no']);
    $filter['print_sn'] = empty($_REQUEST['print_sn']) ? '' : trim($_REQUEST['print_sn']);
    $filter['status'] = empty($_REQUEST['status']) ? '' : intval($_REQUEST['status']);
    $filter['orderstatus'] = empty($_REQUEST['orderstatus']) ? '' : intval($_REQUEST['orderstatus']);
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    $where = " where o.country " . $GLOBALS['city_code'] . " ";
    if ($filter['sdate']) {
        $where .= " and best_time > '" . $filter['sdate'] . "' and best_time < '" . $filter['sdate'] . " 23:30:00'";
    }
    if ($filter['turn']) {
        $where .= " and c.turn = '" . $filter['turn'] . "' ";
    }
    if ($filter['employee']) {
        $where .= " and employee_id = '" . $filter['employee'] . "' ";
    }
    if ($filter['pack_no']) {
        $where .= " and d.route_name = '" . $filter['pack_no'] . "' ";
    }
    if ($filter['status']) {
        $where .= " and a.status = '" . $filter['status'] . "' ";
    }
    if ($filter['orderstatus'] == 0) {
        $where .= " and order_status =0 ";
    }
    if ($filter['orderstatus'] == 1) {
        $where .= " and order_status =1 ";
    }
    if ($filter['orderstatus'] == 2) {
        $where .= " and order_status =2 ";
    }
    if ($filter['orderstatus'] == 3) {
        $where .= " and order_status =3 ";
    }
    if ($filter['orderstatus'] == 4) {
        $where .= " and order_status =4 ";
    }
    if ($filter['order_sn']) {
        if (str_len($filter['order_sn']) == 5) {
            $where .= " and order_sn like '%" . $filter['order_sn'] . "' ";
        } else {
            $where = " where order_sn = '" . $filter['order_sn'] . "' ";
        }
    }
    if ($filter['station'] && $filter['station'] != 100) {
        $where .= " and d.station_id = '" . $filter['station'] . "' ";
    }
    if ($filter['print_sn']) {
        $where .= "and p.print_sn = '" . $filter['print_sn'] . "' ";
    }
    if ($filter['station'] == 100) {
        $where .= " and shipping_station_name is null ";
    }
    if ($filter['sort_by'] == 'shipping_station_name') {
        $orderby = "shipping_pack_no,best_time ";
    } elseif ($filter['sort_by'] == 'shipping_pack_no') {
        $orderby = "shipping_station_name, best_time ";
    } else {
        $orderby = "shipping_station_name, shipping_pack_no ";
    }
    if ($_SESSION['station'] > 0) {
        $where .= " and d.station_id = '" . $_SESSION['station'] . "' ";
    }
    $size = 30;
    $sql = "select count(1) " . "from order_delivery as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join print_log_x as p on a.order_id=p.order_id " . "left join hr_employees as h on a.employee_id=h.id " . "left join ship_route as d on c.route_id=d.route_id " . "left join ship_station as s on d.station_id=s.station_id " . $where;
    $record_count = $GLOBALS['db_read']->getOne($sql);
    $page_count = $record_count > 0 ? ceil($record_count / $size) : 1;
    $sql = "select a.order_id,p.print_sn,o.order_sn,o.city,o.address,o.best_time,c.*,d.*,s.station_name,s.station_code,a.status,h.name as employee_name " . "from order_delivery as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join print_log_x as p on a.order_id=p.order_id " . "left join hr_employees as h on a.employee_id=h.id " . "left join ship_route as d on c.route_id=d.route_id " . "left join ship_station as s on d.station_id=s.station_id " . $where . "order by d.route_name,c.turn,best_time " . "LIMIT " . ($filter['page'] - 1) * $size . ",{$size}";
    $res = $GLOBALS['db_read']->GetAll($sql);
    $sql = "SELECT a.sender,b.name FROM delivery_plan as a,hr_employees as b WHERE a.sender=b.id and bdate = '" . $filter['sdate'] . "' \r\n\t\t\tand a.station_id = '" . $filter['station'] . "'";
    $res2 = $GLOBALS['db_read']->GetAll($sql);
    foreach ($res as $key => $val) {
        $res[$key]['i'] = $key + 1;
        $res[$key]['address'] = region_name($val['city']) . ' ' . $val['address'];
    }
    $arr = array('orders' => $res, 'filter' => $filter, 'page_count' => $page_count, 'record_count' => $record_count, 'senders' => $res2);
    return $arr;
}
开发者ID:songtaiwu,项目名称:mordercms,代码行数:84,代码来源:shipping_delivery.php


示例13: createLicense

function createLicense($max_id, $sum)
{
    $yard = yard();
    $license = array();
    for ($i = 0; $i < $sum; $i++) {
        $time = time() + ++$max_id;
        //时间戳加上当前最大的id号表示唯一
        $li = dechex($time);
        //将唯一编号转换为十六进制
        $total = 0;
        for ($j = 0; $j < str_len($li); $j++) {
            $res = ord($li[$j]);
            //计算这些十六进制asic码总和
            $total += $res;
        }
        $total = $total % 36;
        //将total模上36,获取最后一位校验码
        $y = $yard[$total];
        $li = $li . "" . $y;
        $license[] = $li;
        // 		echo $li.'<br><br>';
    }
    return $license;
}
开发者ID:dalinhuang,项目名称:hteacher,代码行数:24,代码来源:license.php


示例14: convert_back_cbs

function convert_back_cbs($cb_val)
{
    $cb_str = (string) $cb_val;
    $len = str_len($cb_arr);
    while ($len <= 5) {
        $cb_str .= '0';
        $len++;
    }
    return str_split($cb_str);
}
开发者ID:pswnr9,项目名称:TeamW,代码行数:10,代码来源:checking_helper.php


示例15: max_length

 /**
  * Max Length
  *
  * @access	public
  * @param	string
  * @param	value
  * @return	bool
  */
 public function max_length($str, $val)
 {
     if (preg_match("/[^0-9]/", $val)) {
         return FALSE;
     }
     //if (function_exists('mb_strlen'))
     //{
     //	return (mb_strlen($str) > $val) ? FALSE : TRUE;
     //}
     return str_len($str) > $val ? FALSE : TRUE;
 }
开发者ID:stoneStyle,项目名称:startbbs,代码行数:19,代码来源:Form_validation.php


示例16: hasData

function hasData($fieldName)
{
    return str_len(trim($_POST[$fieldName])) !== 0;
}
开发者ID:stumpdk,项目名称:OnlineArchiveIndexTool,代码行数:4,代码来源:save.php


示例17: send

 /**
  * 封装短信发送接口
  * url最长不能超过2083
  */
 function send($phones, $msg, $school_code, $class_code, $creator, $suf = '')
 {
     $result = array('error' => 0, 'msg' => '');
     //检查手机号码是否正确,手机号总长度不超过1024
     if (empty($phones) || str_len($phones) == 0) {
         return array('error' => 1, 'msg' => '手机号码不能为空');
     }
     if (str_len($phones) > 1024) {
         return array('error' => 1, 'msg' => '手机号码过长,最多可同时发送给100个客户');
     }
     $phones_tmp = explode(",", $phones);
     $error_phones = array();
     foreach ($phones_tmp as $k => $p) {
         if (!is_moblie($p)) {
             $error_phones[] = $p;
         }
     }
     if (count($error_phones) > 0) {
         $erro = implode(",", $error_phones);
         return array('error' => 1, 'msg' => '您发送的号码中有错误号码:' . $erro . '');
     }
     //对号码进行去重
     $phones = removeRepeat($phones_tmp);
     //检查短信内容是否包含有敏感字符,短信内容不能超过512个字符
     if (empty($msg) || str_len($msg) == 0) {
         return array('error' => 1, 'msg' => '短信内容不能为空');
     }
     if (str_len($msg) > 512) {
         return array('error' => 1, 'msg' => '短信内容不能超过512个字符');
     }
     //检查是否带了签名
     if (stripos($msg, "【") <= -1 || stripos($msg, "】") <= -1) {
         if ($suf) {
             $this->suf = suf;
         }
         $msg .= $this->suf;
     }
     $error_words = array();
     foreach ($this->sense as $k => $v) {
         if (stripos($msg, $v) > -1) {
             $error_words[] = $v;
         }
     }
     if (count($error_words) > 0) {
         $erro = implode("|", $error_words);
         return array('error' => 1, 'msg' => '您发送的短信内容中存在敏感词汇:' . $erro . '');
     }
     /**
      * 1、将短信插入到短信队列
      * 2、发送短信
      * 3、更新短信队列中的状态
      * 4、更新短信服务器的总条数记录
      */
     $school_code = $school_code != "super" ? $school_code : 'hteacher';
     $database = $school_code ? $school_code : 'hteacher';
     if ($database != "hteacher" && !strpos($database, "_school")) {
         $database = $database . '_school';
     }
     $sql = "insert into " . $database . ".ht_sms (content,phones, status, class_code, creator, created ) \n\t\t\tvalues ('" . $msg . "','" . $phones . "',0,'" . $class_code . "','" . $creator . "',now())";
     $this->db->query($sql);
     $sms_id = $this->db->insert_id();
     $info = $this->sendSMS($phones, $msg);
     if (empty($info[0]) || $info[0] == 0) {
         $sql = "update " . $database . ".ht_sms set status=2 where sms_id=" . $sms_id;
         $this->db->query($sql);
         return array('error' => 1, 'msg' => '短信发送失败:' . $info[1] . '');
     }
     $sql = "update " . $database . ".ht_sms set status=1, num='" . $info[1] . "',sended=now() where sms_id=" . $sms_id;
     $this->db->query($sql);
     $sql = "update hteacher.ht_sms_server set used=used+" . $info[1] . " where sms_server_id=" . $this->sms_server_id;
     $this->db->query($sql);
     return $result;
 }
开发者ID:dalinhuang,项目名称:hteacher,代码行数:77,代码来源:cls_sms.php


示例18: str_len

         $error_user_list = $cls_user->test_conflict($test_user_list);
         //检查
         if ($error_user_list) {
             $domain_len = 0 - str_len($domain);
             $count = count($error_user_list);
             for ($i = 0; $i < $count; $i++) {
                 $error_user_list[$i] = substr($error_user_list[$i], 0, $domain_len);
             }
             /* 将用户标记为改名失败 */
             $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '1' WHERE " . db_create_in($error_user_list, 'user_name');
         }
         /* 检查改名后用户是否与商城用户重名 */
         $sql = "SELECT user_name FROM " . $GLOBALS['ecs']->table('users') . " WHERE " . db_create_in($test_user_list, 'user_name');
         $error_user_list = $GLOBALS['db']->getCol($sql);
         if ($error_user_list) {
             $domain_len = 0 - str_len($domain);
             $count = count($error_user_list);
             for ($i = 0; $i < $count; $i++) {
                 $error_user_list[$i] = substr($error_user_list[$i], 0, $domain_len);
             }
             /* 将用户标记为改名失败 */
             $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '1' WHERE " . db_create_in($error_user_list, 'user_name');
         }
     }
 }
 if ($start + $size < $total) {
     $result['start'] = $start + $size;
     $result['content'] = sprintf($_LANG['notice'], $result['start'], $total);
 } else {
     $start = $total;
     $result['content'] = $_LANG['check_complete'];
开发者ID:GYWang1983,项目名称:fruit,代码行数:31,代码来源:integrate.php


示例19: isset

require ROOT_PATH . '/includes/cls_sms.php';
$action = isset($_REQUEST['act']) ? $_REQUEST['act'] : 'def';
switch ($action) {
    case 'def':
        $sql = "select * from " . $ecs->table("student") . " where is_active=1 ";
        //and license!=''
        $students = $db->getAll($sql);
        $smarty->assign("students", $students);
        $smarty->display('sms_def.htm');
        exit;
    case 'send':
        $phones = trim($_POST["phones"]);
        $content = trim($_POST["content"]);
        $copy = trim($_POST["copy"]);
        $result = array("error" => 1, "msg" => "您选择的家长的电话号码全部为空");
        if (str_len($phones) > 4) {
            if ($copy) {
                $admin = get_admin_by_id($_SESSION["admin_id"]);
                if (is_moblie($admin["cellphone"])) {
                    $phones .= "," . $admin["cellphone"];
                }
            }
            $sms = new sms();
            $result = $sms->send($phones, $content, $school_code, $class_code, $_SESSION["admin_name"]);
        }
        make_json($result);
        exit;
    case 'record':
        $smarty->display('sms_list.htm');
        exit;
    case 'ajax_list':
开发者ID:dalinhuang,项目名称:hteacher,代码行数:31,代码来源:sms.php


示例20: strlen

 function strlen()
 {
     $str = "我是一个php程序员";
     $count = str_len($str);
     echo $count;
 }
开发者ID:sujinw,项目名称:tcphp,代码行数:6,代码来源:indexControl.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP str_limit函数代码示例发布时间:2022-05-23
下一篇:
PHP str_is函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap