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


PHP cut_string函数代码示例

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


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

示例1: breakKey

function breakKey($content, $title, $tag = 0)
{
    $title = mb_strtolower($title, "UTF-8");
    $array = explode(".", $content);
    $contentReturn = '';
    $arrayKey = explode(" ", $title);
    $arraySort = array();
    $arResult = array();
    foreach ($array as $key => $value) {
        $value = mb_strtolower($value, "UTF-8");
        $arrayCau = explode(" ", $value);
        $result = array_intersect($arrayKey, $arrayCau);
        $arraySort[$key] = count($result);
        $arResult[$key] = $result;
    }
    arsort($arraySort);
    $i = 0;
    foreach ($arraySort as $key => $value) {
        $i++;
        if (isset($array[$key]) && isset($arResult[$key])) {
            $contentReturn = $contentReturn . replaceTag(cut_string($array[$key], 200), $arResult[$key]) . '. ';
        }
        if ($i == 3) {
            break;
        }
    }
    unset($result);
    unset($arraySort);
    unset($arResult);
    if ($tag == 1) {
        $this->text .= strip_tags($contentReturn);
    }
    $contentReturn = str_replace("</b>", " ", $contentReturn);
    return $contentReturn;
}
开发者ID:virutmath,项目名称:crm_local,代码行数:35,代码来源:functions.php

示例2: breakKey

function breakKey($g, $h, $j = 0)
{
    $h = mb_strtolower($h, "UTF-8");
    $l = explode(".", $g);
    $n = '';
    $o = explode(" ", $h);
    $p = array();
    $q = array();
    foreach ($l as $r => $s) {
        $s = mb_strtolower($s, "UTF-8");
        $t = explode(" ", $s);
        $u = array_intersect($o, $t);
        $p[$r] = count($u);
        $q[$r] = $u;
    }
    arsort($p);
    $w = 0;
    foreach ($p as $r => $s) {
        $w++;
        if (isset($l[$r]) && isset($q[$r])) {
            $n = $n . replaceTag(cut_string($l[$r], 200), $q[$r]) . '. ';
        }
        if ($w == 3) {
            break;
        }
    }
    unset($u);
    unset($p);
    unset($q);
    if ($j == 1) {
        $x->text .= strip_tags($n);
    }
    $n = str_replace("</b>", " ", $n);
    return $n;
}
开发者ID:virutmath,项目名称:suckhoe,代码行数:35,代码来源:functions.php

示例3: short_description

function short_description($string, $len)
{
    if (strlen($string) > $len) {
        $string = cut_string($string, $len);
        $string .= ' ...';
    }
    return $string;
}
开发者ID:RowdyChildren,项目名称:49sd-ctf,代码行数:8,代码来源:general.inc.php

示例4: getNotice

 public function getNotice()
 {
     $query = "\n            SELECT\n                ba.idx,\n                ba.title,\n                bc.contents\n            FROM\n                tb_bbs_article AS ba,\n                tb_bbs_contents AS bc\n            WHERE\n                ba.bbs_idx = ?\n                AND ba.is_notice = ?\n                AND ba.idx = bc.article_idx\n                AND ba.bbs_idx = bc.bbs_idx\n            ORDER BY ba.idx DESC\n        ";
     $query = $this->db->query($query, array(3, '1'));
     $list = $query->result_array();
     foreach ($list as &$article) {
         $article['contents'] = cut_string($article['contents'], 200);
     }
     echo json_encode($list);
 }
开发者ID:AidenJeon,项目名称:tapbbs_cikorea,代码行数:10,代码来源:cikorea.php

示例5: server_query_frontlines

function server_query_frontlines($ip, $port, $q_port, $request)
{
    global $server_timeout;
    $q_port = empty($q_port) ? 5478 : $q_port;
    @set_time_limit(2);
    $fp = @fsockopen("udp://" . $ip, $q_port, $errno, $errstr, $server_timeout);
    if ($request == "players") {
        fwrite($fp, "ÿÿÿÿW");
        $challenge_packet = fread($fp, 4096);
        if (!$challenge_packet) {
            return FALSE;
        }
        $challenge_code = substr($challenge_packet, 5, 4);
    }
    if ($request == "players") {
        fwrite($fp, "ÿÿÿÿU{$challenge_code}");
    } else {
        fwrite($fp, "ÿÿÿÿFLSQ");
    }
    $buffer = fread($fp, 4096);
    if (!$buffer) {
        return FALSE;
    }
    if ($request == "info") {
        $buffer = substr($buffer, 6);
        // REMOVE PACKET HEADER
        $data['hostname'] = cut_string($buffer);
        $data['mapname'] = cut_string($buffer);
        $data['gamemod'] = strtolower(cut_string($buffer));
        $data['gametype'] = cut_string($buffer);
        $data['players'] = _unpack(cut_byte($buffer, 1), "C");
        $data['maxplayers'] = _unpack(cut_byte($buffer, 1), "C");
        return $data;
    }
    if ($request == "players") {
        $buffer = substr($buffer, 4);
        // REMOVE PACKET HEADER
        $response_type = cut_byte($buffer, 1);
        $returned = ord(cut_byte($buffer, 1));
        $player = array();
        $player_key = 0;
        while ($buffer) {
            $player[$player_key]['pid'] = ord(cut_byte($buffer, 1));
            $player[$player_key]['name'] = cut_string($buffer);
            $player[$player_key]['score'] = _unpack(cut_byte($buffer, 4), "N");
            $player[$player_key]['time'] = _time(_unpack(strrev(cut_byte($buffer, 4)), "f"));
            $player[$player_key]['ping'] = _unpack(cut_byte($buffer, 2), "n");
            $player[$player_key]['uid'] = _unpack(cut_byte($buffer, 4), "N");
            $player[$player_key]['team'] = ord(cut_byte($buffer, 1));
            $player_key++;
        }
        $player = array_reverse($player);
        return $player;
    }
}
开发者ID:nopuls,项目名称:dzcp,代码行数:55,代码来源:frontlines.php

示例6: class_list

function class_list($Selected=0){
	global $Classes;
	$Return = '';
	foreach ($Classes as $ID => $Class) {
		$Name = $Class['Name'];
		$Level = $Class['Level'];
		$Return.='<option value="'.$Level.'"';
		if($Selected == $Level){
			$Return.=' selected="selected"';
		}
		$Return.='>'.cut_string($Name, 20, 1).'</option>'."\n";
	}
	reset($Classes);
	return $Return;
}
开发者ID:4play,项目名称:gazelle2,代码行数:15,代码来源:forum_list.php

示例7: prepare_hoidap_record

function prepare_hoidap_record(&$row_news, $type_image = 'mobile')
{
    if (isset($row_news['que_title']) && $row_news['que_title']) {
        $row_news['que_title'] = htmlspecialbo($row_news['que_title']);
    }
    if (isset($row_news['que_image']) && $row_news['que_image']) {
        $row_news['que_image_low'] = get_picture_path($row_news['que_image'], $type_image . '_low');
        $row_news['que_image'] = get_picture_path($row_news['que_image'], $type_image);
    }
    if (isset($row_news['que_question_content']) && $row_news['que_question_content']) {
        $row_news['full_question_content'] = $row_news['que_question_content'];
        $row_news['que_question_content'] = removeHTML($row_news['que_question_content']);
        $row_news['que_question_content'] = cut_string($row_news['que_question_content'], 50);
    }
    if (isset($row_news['que_date']) && $row_news['que_date']) {
        $row_news['post_time'] = date('d/m/Y | H:i', $row_news['que_date']);
    }
    $row_news['link_detail'] = generate_hoidap_detail($row_news);
    return $row_news;
}
开发者ID:virutmath,项目名称:suckhoe,代码行数:20,代码来源:mobile_custom_function.php

示例8: strlen

                <div class="infomainconstructioncol2">
                    <h1><a title="<?php 
    echo $row->{'title_' . $this->language};
    ?>
" href="<?php 
    echo $base_url . $this->lang->lang();
    ?>
/projects/<?php 
    echo $row->title_none;
    ?>
"><?php 
    echo $row->{'title_' . $this->language};
    ?>
</a></h1>
                    <p><?php 
    echo strlen($row->{'short_' . $this->language}) > 150 ? cut_string($row->{'short_' . $this->language}, 150) . ' ...' : $row->{'short_' . $this->language};
    ?>
</p>
                    <div class="readmore">
                        <a title="<?php 
    echo $row->{'title_' . $this->language};
    ?>
" href="<?php 
    echo $base_url . $this->lang->lang();
    ?>
/projects/<?php 
    echo $row->title_none;
    ?>
"><?php 
    echo lang('view_more');
    ?>
开发者ID:lxthien,项目名称:batdongsan,代码行数:31,代码来源:project.php

示例9: gen_keyword_search

/**
 * Tach chuoi tu khoa thanh cum 2 tu
**/
function gen_keyword_search($string){
   $string  = cut_string($string,50,"");
   $string  = replaceFCK($string,1);
   $text    = str_convert_num_code_to_char($string);    
   $text                  = mb_strtolower($text,"UTF-8"); 
   $code_entities_match   = array('&mdash;',' ','--','&quot;','!','@','#','$','%','^','&','*','(',')','_','+','{','}','|',':','"','<','>','?','[',']','\\',';',"'",',','.','/','*','+','~','`','=', '“','”',"'", '‘', '’', '--'); 
   $code_entities_replace = array('','-','-','','','','','','','','','','','','','','','','','','-','','','','','','', '','','','','','-'); 
   $title = str_replace($code_entities_match, $code_entities_replace, $text); 
   $arr_place  = array("     ","    ","   ","  ");
   $title      = str_replace($arr_place," ",$title);
   $title      = str_replace($arr_place," ",$title);
   $title      = str_replace("-"," ",$title);
   $array_text = explode(" ",$title);
   $arrKey     = array();
   for($i = 0; $i < count($array_text) - 1; $i++){
      $keyword  = $array_text[$i] . " " . $array_text[$i + 1];
      $keyword  = trim($keyword);
      if(strlen($keyword) > 4){
         $arrKey[] = $keyword;
      }      
   }   
   unset($array_text);
   return $arrKey;
}
开发者ID:nhphong0104,项目名称:thietkeweb360,代码行数:27,代码来源:functions.php

示例10: die

 *
 * @author Oliver Georgi <og@phpwcms.org>
 * @copyright Copyright (c) 2002-2015, Oliver Georgi
 * @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
 * @link http://www.phpwcms.de
 *
 **/
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
    die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
// Link Articles
$cinfo[1] = html(cut_string($row["acontent_title"], '&#8230;', 55));
$cinfo[2] = html(cut_string($row["acontent_subtitle"], '&#8230;', 55));
$cinfo_alink = unserialize($row["acontent_form"]);
$cinfo_alink = isset($cinfo_alink['alink_id']) ? $cinfo_alink['alink_id'] : explode(':', $row["acontent_alink"]);
$cinfo[3] = '';
if (is_array($cinfo_alink)) {
    foreach ($cinfo_alink as $value) {
        $cinfo[3] .= intval($value) ? "[" . $value . "] " : "";
    }
    $cinfo[3] = $cinfo[3] ? ($cinfo[1] || $cinfo[2] ? "<br />" : "") . trim($cinfo[3]) : "";
}
$cinfo["result"] = "";
foreach ($cinfo as $value) {
    if ($value) {
        $cinfo["result"] .= $value . "\n";
    }
}
开发者ID:Ideenkarosell,项目名称:phpwcms,代码行数:31,代码来源:cnt8.list.inc.php

示例11: get_date_from_sql

        echo $row->title_vietnamese;
        ?>
                                </p>
                            </a>
                        </div>
                    </div>
                    <div style="width:430px; margin-bottom:10px;float:left;">
                        <p style="color:#999999; font-size:12px; margin-left:12px;">Cập nhật: <?php 
        echo get_date_from_sql($row->created);
        ?>
</p>
                    </div>
                    <div class="sreenndtinthitruong" style="width:410px; margin-left:12px; height:70px; float:left;color:#333333;">
                        <p align="justify" style="margin-left:0px; font-size:14px; font-weight:lighter;">
                            <?php 
        echo strlen($row->short_vietnamese) < 300 ? $row->short_vietnamese : cut_string($row->short_vietnamese, 300) . '...';
        ?>
                        </p>
                    </div>
                </div>
            </div>
            <div class="linedot"></div>
            <?php 
    }
    ?>
        <?php 
}
?>

        <div class="phantrang">
            <div class="back">
开发者ID:lxthien,项目名称:batdongsan,代码行数:31,代码来源:news_cat.php

示例12: die

<?php

/**
 * phpwcms content management system
 *
 * @author Oliver Georgi <og@phpwcms.org>
 * @copyright Copyright (c) 2002-2015, Oliver Georgi
 * @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
 * @link http://www.phpwcms.de
 *
 **/
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
    die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
// Content 89: Poll  		jens
$cinfo["result"] = $row["acontent_title"] ? cut_string($row["acontent_title"], '&#8230;', 55) : "";
$cinfo["result"] .= $cinfo["result"] && $row["acontent_subtitle"] ? " / " : "";
$cinfo["result"] .= $row["acontent_subtitle"] ? cut_string($row["acontent_subtitle"], '&#8230;', 55) : "";
$poll_text = unserialize($row["acontent_text"]);
if ($cinfo["result"]) {
    echo "<tr><td>&nbsp;</td><td class=\"v10\">";
    echo "<a href=\"phpwcms.php?do=articles&amp;p=2&amp;s=1&amp;aktion=2&amp;id=" . $article["article_id"] . "&amp;acid=" . $row["acontent_id"] . "\">";
    echo $cinfo["result"] . "</a></td><td>&nbsp;</td></tr>";
}
开发者ID:EDVLanger,项目名称:phpwcms,代码行数:27,代码来源:cnt89.list.inc.php

示例13: the_title

        ?>
						</div>
						<div class="article-box">
							<header class="entry-header">
								<?php 
        if (is_single()) {
            the_title('<h2 class="entry-title" itemprop="name headline">', '</h2>');
        } else {
            the_title('<h2 class="entry-title" itemprop="name headline"><a href="' . esc_url(get_permalink()) . '" itemprop="url" rel="bookmark">', '</a></h2>');
        }
        ?>
							</header>
							<div class="post-entry post-content">
								<p class="conetent-string">
								<?php 
        echo cut_string(strip_tags(apply_filters('the_content', $post->post_content)), 42);
        ?>
								 <?php 
        if (comments_open() && !is_single()) {
            ?>
									<span class="comments-num"><?php 
            comments_popup_link('0', '1', '%');
            ?>
</span>
								<?php 
        }
        // comments_open()
        ?>
								</p>
							</div>
							<footer class="post-meta">
开发者ID:alongbao,项目名称:M-V2EX,代码行数:31,代码来源:archive.php

示例14: cut_string

        $prefix['cg35_14-18'] = '/14-18';
        $print_url = MASTER_URL . $prefix[$item['dbname']] . '/items/print/id/' . $item['item_id'];
        $print_csv_url = MASTER_URL . $prefix[$item['dbname']] . '/items/csv/id/' . $item['item_id'];
        echo '<div class="item">';
        echo '  <a href="' . $delete_url . '" class="delete" title="Enlever cette notice du panier">Enlever cette notice du panier</a>';
        echo '  <div class="notice">Notice</div>';
        echo '  <h2><a href="' . $item['url'] . '">' . $item['text'] . '</a></h2>';
        echo '  <div class="date">';
        if ($item['date']) {
            echo 'Date : ' . $item['date'] . ' | ';
        }
        if ($item['reference']) {
            echo 'Référence : ' . $item['reference'];
        }
        echo '</div>';
        echo '  <div class="description">' . cut_string(strip_tags($item['description']), 500) . '</div>';
        echo '  <span class="notes">Mes notes</span>';
        echo '  <textarea placeholder="Rédiger une note" name="note" rel="' . $item['id'] . '">' . $item['note'] . '</textarea>';
        echo '  <div class="btn-save"><a href="#" class="save-note" rel="' . $item['id'] . '">Enregistrer mes notes</a></div>';
        echo '  <div class="item-actions" style="margin-top:15px; margin-bottom:25px;">';
        echo '      <a target="_blank" href="' . $print_url . '" class="print">Imprimer</a>';
        echo '      <a target="_blank" href="' . $print_url . '" class="download">PDF</a>';
        echo '      <a href="' . $print_csv_url . '" class="download-csv">CSV</a>';
        echo '      <a href="' . $item['url'] . '" class="view">Voir la notice</a>';
        echo '  </div>';
        echo '      <br style="clear:both;"/>';
        // echo '<li><a href="'.$delete_url.'" style="color:orange;" class="fa fa-remove fa-lg"></a> [GUIDE : '.$item['name'].' ] <a href="'.$item_url.'">'.$item['text'].'</a></li>';
        echo '</div>';
    }
}
?>
开发者ID:kyfr59,项目名称:cg35,代码行数:31,代码来源:index.php

示例15: message

 /**
  * 메시지 목록
  * @author KangMin
  * @since  2011.11.09
  */
 public function message()
 {
     $this->add_language_pack($this->language_pack('user_message'));
     $assign = NULL;
     $req_page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1;
     //로그인 상태가 아니면
     if (!defined('USER_INFO_idx')) {
         $this->login_view($assign);
     } else {
         $search = $this->input->get('search');
         //receive box, send box 구분
         $search = $assign['search'] = $search == 'send' ? 'send' : 'receive';
         //validation
         $assign['search_send_active'] = $search == 'send' ? 'ui-btn-active' : '';
         $assign['search_receive_active'] = $search == 'receive' ? 'ui-btn-active' : '';
         $assign['search'] = $search;
         $this->load->model('users_message_model');
         $this->load->library('pagination');
         $assign['total_cnt'] = $this->users_message_model->get_message_total_cnt($search);
         // http://codeigniter-kr.org/user_guide_2.1.0/libraries/pagination.html
         $config['base_url'] = BASE_URL . 'user/message?search=' . $search . '&';
         $config['enable_query_strings'] = TRUE;
         // ?page=10 이런 일반 get 방식
         $config['page_query_string'] = TRUE;
         $config['use_page_numbers'] = TRUE;
         $config['num_links'] = (int) SETTING_count_page_message;
         $config['query_string_segment'] = 'page';
         $config['total_rows'] = $assign['total_cnt'];
         $config['per_page'] = (int) SETTING_count_list_message;
         $this->config->load('pagination');
         $pagination_config = $this->config->item($this->viewport);
         $config = array_merge($config, $pagination_config);
         $this->pagination->initialize($config);
         $assign['pagination'] = $this->pagination->create_links();
         $assign['users_message'] = array();
         if ($assign['total_cnt'] > 0) {
             $assign['users_message'] = $this->users_message_model->get_message($search, ($req_page - 1) * $config['per_page'], $config['per_page']);
         }
         foreach ($assign['users_message'] as $k => &$v) {
             $v->title = cut_string($v->title ? $v->title : $v->contents, SETTING_cut_length_title_message);
             $v->print_name = name($v->user_id, $v->name, $v->nickname);
             $v->is_read_class = "is_read_{$v->is_read}";
             $v->is_read_text = lang($v->is_read_class);
             $v->print_send_date = time2date($v->timestamp_send);
         }
         $this->scope('contents', 'contents/user/message', $assign);
         $this->display('layout');
         #$this->layout->view('user/message_view', $data);
     }
 }
开发者ID:CIKOREA,项目名称:base_tapbbs,代码行数:55,代码来源:user.php


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