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


PHP helper::utf8_substr方法代码示例

本文整理汇总了PHP中helper::utf8_substr方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::utf8_substr方法的具体用法?PHP helper::utf8_substr怎么用?PHP helper::utf8_substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helper的用法示例。


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

示例1: substr

    echo $v['surl'];
    ?>
" onclick="locaUrl(this)">
							<?php 
    if (!empty($v['thumb']) && $v['thumb'] != 'thumb_') {
        echo '<a class="app-img" href="' . $v['surl'] . '"><img src="' . substr(SITE_PATH, 0, -1) . $v['thumb'] . '" border="0">
							</a>';
    }
    ?>
							<div class="app-info">
								<div class="info_title"><?php 
    echo $v['info_title'];
    ?>
</div>
								<?php 
    echo helper::utf8_substr(strip_tags($v['info_desc']), 0, 60);
    ?>
							</div>
						</li>
						<?php 
}
?>
					</ul>
                </div>
				<!----分--割--线---->
            </div>
			<!--加载底部 开始-->
				<?php 
require_once 'inc_foot.php';
?>
			<!--加载底部 结束-->
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:index.php

示例2:

								<img style="width:80px;height:40px;" src="<?php 
        echo $v['info_img'];
        ?>
">
							</div>
							<?php 
    }
    ?>
							<h2>
								<?php 
    echo $v['info_title'];
    ?>
							</h2>
							<p class="onlyheight">
								<?php 
    echo helper::utf8_substr(htmlspecialchars_decode($v['info_desc']), 0, 180);
    ?>
							</p>
							<div class="commentNum"></div>
						</a>
					</li>
					<?php 
}
?>
				</ul>
			</div>
			<section id="Page_wrapper">
				<div id="pNavDemo" class="c-pnav-con">
					<section class="c-p-sec">
						<div class="c-p-pre c-p-grey ">
							<span class="c-p-p">
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:list_info.php

示例3: foreach

    foreach ($table_list['list'] as $key => $val) {
        $alone_id = $val[$table . '_id'];
        $alone_field = $table . '_id';
        $extern_id = $filed_list['extern_id'];
        ?>
                   <tr>
						<?php 
        $i = 0;
        foreach ($val as $kk => $vv) {
            if ($i > 8) {
                break;
            }
            if (is_upload($_GET['extern_id'], $kk) && $vv != '') {
                $vv = '<img width="50" height="50" src="' . $vv . '">';
            } elseif ($i == 0) {
                $vv = '<center>' . helper::utf8_substr($vv, 0, 11) . '</center>';
            } elseif ($i == 1) {
                $action = $vv == 0 ? "屏蔽" : "通过";
                $vv = vars::get_field_str('is_check', $vv, 'html');
            } elseif ($i == 2) {
                $vv = date("Y-m-d H:i:s", $vv);
            } else {
                //$vv = helper :: utf8_substr($vv, 0, 10);
            }
            if (date_type($_GET['extern_id'], $kk)) {
                $vv = date("Y-m-d", intval($vv));
            }
            if ($i == 0) {
                ?>
						 <td><input type="checkbox" value="<?php 
                echo strip_tags($vv);
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:tpl_alone_table.php

示例4: get_list_tag


//.........这里部分代码省略.........
                 $result = $this->dbm->query($sql, $suffix, $count);
                 for ($i = 0; $i < count($result['list']); $i++) {
                     unset($result['list'][$i]['uid']);
                     unset($result['list'][$i]['uname']);
                 }
                 // 写入缓存
                 $result = helper::file_cache($cache_file, $result, CACHE_TIME, $data_path);
             }
         } else {
             $result = $this->dbm->query($sql, $suffix, $count);
         }
     }
     if ($count == 1) {
         $total = $result['total'];
     } else {
         $result['total'] = $total;
     }
     $result['keyword'] = $keyword;
     if (defined('INFO_IMG') && file_exists(INFO_IMG)) {
         $default_img = INFO_IMG;
     }
     // 重写返回数组
     for ($i = 0; $i < count($result['list']); $i++) {
         $result['list'][$i]['cate'] = $this->categories[$result['list'][$i]['last_cate_id']];
         if ($show_extern == '1') {
             // 取扩展表
             $extern = $this->get_extern_by_cate_id($result['list'][$i]['cate']['cate_id']);
             if ($extern['extern_name'] != '') {
                 $result['list'][$i]['extern'] = $this->get_extern($extern['extern_name'], $result['list'][$i]['info_id']);
             }
             // 取扩展字段结束
         }
         // 取资源列表
         if ($resource == 1) {
             $result['list'][$i]['resource'] = $this->get_resource($result['list'][$i]['info_id']);
             $result['list'][$i]['resource_total'] = count($result['list'][$i]['resource']);
         }
         // 缩略图
         if (isset($result['list'][$i]['info_img'])) {
             if ($result['list'][$i]['info_img'] == '') {
                 $result['list'][$i]['info_img'] = $default_img;
             }
             $result['list'][$i]['thumb'] = $this->thumb_url($result['list'][$i]['info_img']);
         }
         // URL
         $surl_domain = $this->bind_domain($result['list'][$i]['last_cate_id']);
         $result['list'][$i]['surl'] = ($surl_domain == '' ? $this->url_recheck() : $surl_domain) . $this->url->encode('content_info', array('host' => SITE_PATH, 'id' => $result['list'][$i]['info_id']));
         if ($result['list'][$i]['info_url'] != '') {
             $result['list'][$i]['surl'] = $result['list'][$i]['info_url'];
         }
         // 资讯标题
         // 标题加粗
         $result['list'][$i]['info_style_title'] = $result['list'][$i]['info_title'];
         if ($result['list'][$i]['fbold'] == 1) {
             $result['list'][$i]['info_style_title'] = "<b>" . $result['list'][$i]['info_title'] . "</b>";
         }
         // 标题加亮
         if (!empty($result['list'][$i]['fcolor'])) {
             $result['list'][$i]['info_style_title'] = "<font color='" . $result['list'][$i]['fcolor'] . "'>" . $result['list'][$i]['info_style_title'] . "</font>";
         }
         // 资讯简介
         if ($result['list'][$i]['info_desc'] == '') {
             $result['list'][$i]['info_desc'] = helper::utf8_substr(preg_replace('~(<style[^>]*>[\\w\\W]*?</style>)|(<[^>]*>)|(\\r)|(\\n)|(\\t)~', '', $result['list'][$i]['info_body']), 0, 220);
         }
         //精确标签输出
         //查询关系表中的关键字ID
         if ($show_tags == 1) {
             $sql = "select keyword_id from " . TB_PREFIX . "keyword_relation where info_id= '{$result['list'][$i]['info_id']}'";
             $r = $this->dbm->query($sql);
             $ids = array();
             foreach ($r['list'] as $k => $v) {
                 array_push($ids, $v['keyword_id']);
             }
             $sql = "select * from " . TB_PREFIX . "keyword where keyword_id in (" . implode(',', $ids) . ")";
             $ret = $this->dbm->query($sql);
             $result['tags_html'] = '';
             if (count($ret['list']) > 0) {
                 $result['list'][$i]['tags'] = array();
                 $result['list'][$i]['tags_html'] = '';
                 foreach ($ret['list'] as $k => $v) {
                     $result['list'][$i]['tags'][] = $v['keyword'];
                     $result['list'][$i]['tags_html'] .= '<a href="' . $this->url->encode('tag_index', array('host' => SITE_PATH, 'extid' => $this->categories[$result['list'][$i]['last_cate_id']]['extern_id'], 'id' => $v['keyword_id'])) . '" target="_blank">' . $v['keyword'] . '</a>&nbsp;&nbsp;';
                 }
             }
         }
     }
     // 分页码HTML
     if ($rewrite == 0 || $rewrite == 1) {
         // 前台使用动态地址或者伪静态地址
         if ($this->url != null && $params['count'] == 1) {
             $cpy = '';
             $result['pagebar'] = helper::pagebar(array('total' => $total, 'pagesize' => $pagesize, 'rewrite' => $rewrite, 'rule' => array('node' => $node, 'obj' => $this->url, 'params' => array('host' => SITE_PATH, 'id' => $keyword_id, 'p' => $p))));
         } else {
             $result['pagebar'] = array('pagecode' => '');
         }
     } else {
         $result['pagebar'] = helper::pagebar(array('total' => $total, 'pagesize' => $pagesize, 'rewrite' => $rewrite));
     }
     return $result;
 }
开发者ID:cranefly,项目名称:crane,代码行数:101,代码来源:common.class.php

示例5: get_content

 /**
  * 取文档
  *
  * @param  $id 文档ID
  * @param  $no_cache 1=强制读取最新数据
  * @param  $info_state
  * @param  $is_page 是否正文分页 1=是 0=不需要
  */
 public function get_content($id, $no_cache = 0, $info_state = false, $is_page = 1, $is_admin = 0)
 {
     $content = array();
     if (!is_numeric($id)) {
         return $content;
     }
     $sql = "select * from " . TB_PREFIX . "info_list where info_id='{$id}' ";
     if ($info_state) {
         $sql .= " and info_state=0 ";
     }
     $sql .= " limit 1";
     // 缓存开启,获取缓存内容
     if ($no_cache == 1) {
         $rs = $this->dbm->query($sql);
         //print_r($no_cache.'---111'.$rs);die();
     } else {
         if (defined('CACHE_TIME') && CACHE_TIME != '' && CACHE_TIME != 0) {
             $cache_file = md5($sql);
             $data_path = SITE_PATH . CACHE_NAME . '/content/' . substr($cache_file, 0, 2);
             //print_r($data_path);die();
             $rs = helper::file_cache($cache_file, '', CACHE_TIME, $data_path);
             if ($rs == 'timeout') {
                 $rs = $this->dbm->query($sql);
                 $rs = helper::file_cache($cache_file, $rs, CACHE_TIME, $data_path);
             }
         } else {
             // print_r($data_path);die();
             $rs = $this->dbm->query($sql);
         }
     }
     //print_r($rs);
     if (count($rs['list']) > 0) {
         $content = $rs['list'][0];
         if ($is_admin == 1) {
             $content['info_body'] = preg_replace('~&#34;~', '', htmlspecialchars_decode($content['info_body']));
             $content['info_body'] = preg_replace('~<p([^>]*)>\\n~', '<p$1>', $content['info_body']);
         }
         if (isset($_GET['preview']) && $_GET['preview'] == '1') {
             //预览方式不解码
         } else {
             $content['info_body'] = htmlspecialchars_decode($content['info_body']);
         }
         if (!get_magic_quotes_gpc()) {
             $content['info_body'] = stripslashes($content['info_body']);
         }
         $content['info_title_original'] = $content['info_title'];
         $content['publish_time_str'] = date('Y-m-d H:i:s', $content['publish_time']);
         // if (strlen($content['info_stitle']) <= 0) $content['info_stitle'] = $content['info_title']; // SEO别名
         if (isset($content['info_img'])) {
             $content['thumb'] = $this->thumb_url($content['info_img']);
             // 缩略图
         }
         // 资讯简介
         if ($content['info_desc'] == '') {
             $content['info_desc'] = helper::utf8_substr(preg_replace('~(<style[^>]*>[\\w\\W]*?</style>)|(<[^>]*>)|(\\r)|(\\n)|(\\t)~', '', $content['info_body']), 0, 220);
         }
         $content['resource'] = $this->get_resource($id);
         // 取外部资源
         //查询关系表中的关键字ID
         $sql = "select keyword_id from " . TB_PREFIX . "keyword_relation where info_id= '{$id}'";
         $r = $this->dbm->query($sql);
         $ids = array();
         for ($i = 0; $i < count($r['list']); $i++) {
             $ids[] = $r['list'][$i]['keyword_id'];
         }
         if (is_array($ids) && !empty($ids)) {
             $content['keword_ids'] = implode(',', $ids) . ',';
         }
         $sql = "select * from " . TB_PREFIX . "keyword where keyword_id in (" . implode(',', $ids) . ")";
         $ret = $this->dbm->query($sql);
         $content['tags_html'] = '';
         if (count($ret['list']) > 0) {
             $content['tags'] = array();
             foreach ($ret['list'] as $k => $v) {
                 $content['tags'][] = $v['keyword'];
                 $content['tags_html'] .= '<a href="' . $this->url->encode('tag_index', array('host' => SITE_PATH, 'extid' => $this->categories[$content['last_cate_id']]['extern_id'], 'id' => $v['keyword_id'])) . '" target="_blank">' . $v['keyword'] . '</a>&nbsp;&nbsp;';
             }
         }
         //如果文章图片为空,把资源的第一个图片放到文章图片上
         if (empty($content['info_img']) && count($content['resource']) > 0) {
             $content['info_img'] = isset($content['resource'][0]['resource_url']) ? $content['resource'][0]['resource_url'] : '';
         }
         // 取上下篇
         $rs_next = $this->get_list(array('type' => 0, 'cate_id' => $content['last_cate_id'], 'where' => " info_id>" . $id . " and info_url=''", 'pagesize' => 1, 'order' => 'order by info_id asc', 'no_cache' => $no_cache));
         $rs_prev = $this->get_list(array('type' => 0, 'cate_id' => $content['last_cate_id'], 'where' => " info_id<" . $id . " and info_url=''", 'pagesize' => 1, 'order' => 'order by info_id desc', 'no_cache' => $no_cache));
         $content['next']['surl'] = '';
         $content['next']['info_title'] = '';
         if (count($rs_next['list']) > 0) {
             $content['next']['surl'] = $rs_next['list'][0]['surl'];
             $content['next']['info_title'] = $rs_next['list'][0]['info_stitle'] == '' ? $rs_next['list'][0]['info_title'] : $rs_next['list'][0]['info_stitle'];
         }
         $content['prev']['surl'] = '';
//.........这里部分代码省略.........
开发者ID:cranefly,项目名称:crane,代码行数:101,代码来源:common.class.php

示例6: foreach

        if ($v['cate_id'] == $con['last_cate_id']) {
            $class = ' class="left-nav-first left-nav-cur"';
        } else {
            $class = '';
        }
        echo '<li' . $class . '><a href="' . $v['surl'] . '">' . helper::utf8_substr($v['cname'], 0, 8) . '</a></li>';
    }
} else {
    $lists = $c->get_list(array('pagesize' => 20, 'count' => 1, 'cate_id' => $con['last_cate_id'], 'rewrite' => SITE_REWRITEURL, 'p' => $p));
    foreach ($lists['list'] as $k => $v) {
        if ($v['info_id'] == $id) {
            $class = ' class="left-nav-first left-nav-cur"';
        } else {
            $class = '';
        }
        echo '<li' . $class . '><a href="' . $v['surl'] . '">' . helper::utf8_substr($v['info_title'], 0, 8) . '</a></li>';
    }
}
?>
						</ul>
					</div>
					<div class="art-right">
						<div class="right-nav">
						<?php 
$cate_father = $c->cate_father($con['last_cate_id']);
?>
						<a href="/" title="">首页</a>&nbsp;&gt;&nbsp;
						<?php 
if (count($cate_father) > 0) {
    foreach ($cate_father as $k => $v) {
        if (count($cate_father) == ++$k) {
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:content_info.php

示例7:

        $class = 'class="left-nav-first left-nav-cur"';
    } else {
        $class = '';
    }
    ?>
									
							<li <?php 
    echo $class;
    ?>
>
								<a href="<?php 
    echo $v['surl'];
    ?>
">
									<?php 
    echo helper::utf8_substr($v['info_title'], 0, 10);
    ?>
								</a>
							</li>
							<?php 
}
?>
							
							
						</ul>
					</div>
					<div class="art-right">
						<div class="right-nav">
						<?php 
$cate_father = $c->cate_father($cid);
?>
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:list_single.php

示例8: filter_words

function filter_words($_con, $type = '', $isdie = 0)
{
    $replace_word = array("我靠", "他妈的", "干你娘", "妈的", "我草", "我操");
    $no_word = array("枪支", "弹药", "办证", "假证", "办毕业证", "刻章", "名刀大全", "卖猎枪", "卖气枪", "三唑仑", "男女公关", "男公关", "女公关", "A片", "小姐上门", "裸聊", "氰化钾", "东京热", "苯三酚", "窃听器", "炸药", "高仿身份證", "高仿身份证", "鸭子上门", "成人电影", "小姐服务", "炸弹", "报仇毁容", "批发高仿假钱", "帮人复仇", "打架报仇", "打架杀人", "硫酸铊", "左轮手枪", "军刺", "肝脏", "肝源", "腎源", "肾源", "腎脏", "肾臟", "麻黄素", "氰化钠", "AV", "色片", "发票", "发嘌", "发漂", "fapiao", "海洛因", "冰毒", "代开", "假币", "假钞");
    $no_word_user = array("管理员", "站长", "admin", "易找网", "官方", "客服");
    if ($type == 'user') {
        foreach ($no_word_user as $key) {
            $num = count(explode($key, $_con));
            if ($num > 1) {
                die('昵称或者用户名不允许字符:' . $key);
            }
        }
    } elseif ($type == 'replace') {
        foreach ($replace_word as $key) {
            $_con = preg_replace('/(' . $key . ')/i', '***', $_con);
        }
    } else {
        // if(preg_match('/(.+)\1{8,}/i',$_con) && $isdie){die('请不要填写8个以上连续相同无意义的字符');}
        // 精准关键词表
        $fword = file_get_contents('../../core/filter_word.txt');
        $farr = explode("\n", $fword);
        foreach ($farr as $key) {
            $key = helper::utf8_substr($key, 0, strlen($key) - 1);
            $num = count(explode($key, $_con));
            if ($num > 1) {
                die('请不要发布涉黄,毒,枪,色情,制假等非法内容');
            }
        }
        // 宽泛关键词表
        foreach ($no_word as $key) {
            $num = count(explode($key, $_con));
            if ($num > 1) {
                die('请不要发布涉黄,毒,枪,色情,制假等非法内容');
            }
        }
    }
    return $_con;
}
开发者ID:cranefly,项目名称:crane,代码行数:38,代码来源:comment.php

示例9: rtrim

                </div>

                <div class="contents">
					<?php 
$con = $c->get_content(19);
?>
                    <div class="inbox about-company">
                        <h3>
                            <a href="<?php 
echo $c->categories[11]['surl'];
?>
" class="more">
                            </a>
                            <span>
                                <?php 
echo helper::utf8_substr($con['info_title'], 0, 110);
?>
                            </span>
                        </h3>
                        <div class="con">
                            <div class="about-logo">
                                <img src="<?php 
echo rtrim(SITE_PATH, '/') . $con['info_img'];
?>
" alt="<?php 
echo $con['info_title'];
?>
" width="140" height="107">
                            </div>
                            <p>
                                <?php 
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:index.php

示例10: show_comment

function show_comment($comment, $style_prefix = "comment")
{
    $html = '<div class="' . $style_prefix . '_form">';
    foreach ($comment as $c) {
        $html .= '<div class="' . $style_prefix . '_list_con">';
        $html .= '<div>';
        $uname = $c['uname'] == '' ? '匿名评论' : $c['uname'];
        $html .= '<div class="l"><b id="uname' . $c['comment_id'] . '">' . $uname . '</b> &nbsp;' . $c['ip_addr'] . ' ' . helper::utf8_substr($c['ip'], 0, strrpos($c['ip'], '.')) . '.* &nbsp; ' . date('Y-m-d H:i:s', $c['date_add']) . '</div>';
        $html .= '</div>';
        $html .= '<div class="' . $style_prefix . '_list_con_bot"><a href="javascript:void(0);" onclick="ready_reply(' . $c['comment_id'] . ');">回复(<span id="recomment' . $c['comment_id'] . '">' . $c['son'] . '</span>)&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cgood(' . $c['comment_id'] . ');">顶(<span id="good' . $c['comment_id'] . '">' . $c['good'] . '</span>)</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cbad(' . $c['comment_id'] . ');">踩(<span id="bad' . $c['comment_id'] . '">' . $c['bad'] . '</span>)</a>&nbsp;&nbsp;</div>';
        if ($c['reply'] != '') {
            $reply = '<br /><font color=red>管理员回复:{' . $c['reply'] . '}</font>';
        } else {
            $reply = '';
        }
        $html .= '<div>' . (!empty($c['is_check']) ? $c['content'] . $reply : '<font color="red">*******该留言已被屏蔽</font>') . '</div>';
        $html .= '<div id="replay_frame_' . $c['comment_id'] . '"></div>';
        if (isset($c['sons']) && count($c['sons']) > 0) {
            $html .= show_comment($c['sons']);
        }
        $html .= '</div>';
    }
    $html .= '<script type="text/javascript">
        function ready_reply(comment_id){
            try{
            $("#comment_pid").val(comment_id);
            $("#replay_frame_"+comment_id).append($("#comment_reply_box"));
            $("#comment_reply_box").css({"display":""});
            $("#comment_reply").focus();
            }catch(e){alert(e.message)}
        }
        function cgood(comment_id){
            var good=C.cookie.get(\'good\'+comment_id);
            if(good == null) good =0;
            if(typeof(comment_id) =="undefined") return false;
            var comment_id = parseInt(comment_id);
            if(!good){
            $.post("' . SITE_PATH . 'plugins/gov.comment/comment.php?m=cgood",{comment_id:comment_id},function(data){
                var res = eval("("+data+")");
                $("#good"+comment_id).html(res);
                C.cookie.set(\'good\'+comment_id,comment_id)
            });
            }else{
                alert(\'不好意思,您已经表态啦~~~\');
            }
        }
        function cbad(comment_id){
        var cbad=C.cookie.get(\'good\'+comment_id);
        if(cbad == null) cbad =0;
            if(typeof(comment_id) =="undefined") return false;
            var comment_id = parseInt(comment_id);
            if(!cbad){
            $.post("' . SITE_PATH . 'plugins/gov.comment/comment.php?m=cbad",{comment_id:comment_id},function(data){
                var res = eval("("+data+")");
                $("#bad"+comment_id).html(res);
                C.cookie.set(\'good\'+comment_id);

            });
            }else{
                alert(\'不好意思,您已经表态啦~~~\');
            }
        }
        /*
        function recomment (comment_id,nick) {
            $("#parent_id").val(comment_id);
            $("#comment_id").val(comment_id);
            $("#comment").val("回复["+nick+"]:");
            $("#comment").focus();

        }*/
    </script>';
    $html .= '</div>';
    return $html;
}
开发者ID:cranefly,项目名称:crane,代码行数:74,代码来源:comment_html.php


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