本文整理匯總了PHP中CUtils::cut_text方法的典型用法代碼示例。如果您正苦於以下問題:PHP CUtils::cut_text方法的具體用法?PHP CUtils::cut_text怎麽用?PHP CUtils::cut_text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CUtils
的用法示例。
在下文中一共展示了CUtils::cut_text方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getStatic
public function getStatic()
{
return CUtils::cut_text(parent::getStatic());
}
示例2: getTableSearchResults
function getTableSearchResults($text, $tableName, $where = '', $idName = '', $nName = 'name')
{
$ret = array();
$fields = $this->getSearchFieldsArray($tableName);
$fields_text = implode(',', $fields);
$search_query = '';
if (is_array($text)) {
$query_text = '';
foreach ($text as $t) {
if (strlen($t) > 2) {
$query_text .= ($query_text ? ' ' : '') . '+' . $t . '*';
}
}
$search_query = " MATCH(" . $fields_text . ") AGAINST ('" . $query_text . "' IN BOOLEAN MODE)";
} else {
$search_query = " MATCH(" . $fields_text . ") AGAINST ('\"" . $text . "\"' IN BOOLEAN MODE)";
}
$items = $GLOBALS['db']->getItems('get_search_items', "SELECT id," . $nName . ",name, " . $search_query . " AS coef FROM " . $this->tables[$tableName]->getDBTableName() . " WHERE " . $search_query . ($where ? ' AND ' . $where : '') . ' ORDER BY coef');
foreach ($items as $a) {
$ret[] = array('ref' => $this->getSearchResultRef($a, $idName), 'text' => CUtils::cut_text(strip_tags($a[$nName], 150)));
}
return $ret;
}