當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Strings::getSimilar方法代碼示例

本文整理匯總了PHP中Strings::getSimilar方法的典型用法代碼示例。如果您正苦於以下問題:PHP Strings::getSimilar方法的具體用法?PHP Strings::getSimilar怎麽用?PHP Strings::getSimilar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Strings的用法示例。


在下文中一共展示了Strings::getSimilar方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array_keys

<?php

namespace Transvision;

// RTL support
$direction1 = RTLSupport::getDirection($source_locale);
$direction2 = RTLSupport::getDirection($locale);
if ($url['path'] == '3locales') {
    $direction3 = RTLSupport::getDirection($locale2);
    $extra_column_header = "<th>{$locale2}</th>";
} else {
    $extra_column_header = '';
}
$entities = ShowResults::searchEntities($tmx_source, $search->getRegex());
// Display a search hint for the closest string we have if we have no search results
if (count($entities) == 0) {
    $merged_strings = [];
    $best_matches = Strings::getSimilar($initial_search, array_keys($tmx_source), 3);
    include VIEWS . 'results_similar.php';
    return;
}
開發者ID:benoit-l,項目名稱:transvision,代碼行數:21,代碼來源:mainsearch_entities.php

示例2: strtolower

        // We have results, we won't display search suggestions but search results
        $search_yields_results = true;
        $search_id = strtolower(str_replace('-', '', $key));
        $message_count = $real_search_results > $limit_results ? "<span class=\"results_count_{$search_id}\">{$limit_results} results</span> out of {$real_search_results}" : "<span class=\"results_count_{$search_id}\">" . Utils::pluralize(count($search_results), 'result') . '</span>';
        $output[$key] = "<h2>Displaying {$message_count} for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span> in {$key}:</h2>";
        $output[$key] .= ShowResults::resultsTable($search_id, $search_results, $initial_search, $source_locale, $locale, $check);
    } else {
        $output[$key] = "<h2>No matching results for the string " . "<span class=\"searchedTerm\">{$initial_search_decoded}</span>" . " for the locale {$key}</h2>";
    }
}
// Remove duplicated components
$components = array_unique($components);
// Display a search hint for the closest string we have if we have no search results
if (!$search_yields_results) {
    $merged_strings = [];
    foreach ($data as $key => $values) {
        $merged_strings = array_merge($merged_strings, array_values($values));
    }
    $best_matches = Strings::getSimilar($initial_search, $merged_strings, 3);
    include VIEWS . 'results_similar.php';
    return;
} else {
    if (in_array($check['repo'], $desktop_repos)) {
        // Build logic to filter components
        $javascript_include[] = '/js/component_filter.js';
        $filter_block = '';
        foreach ($components as $value) {
            $filter_block .= " <a href='#{$value}' id='{$value}' class='filter'>{$value}</a>";
        }
    }
}
開發者ID:benoit-l,項目名稱:transvision,代碼行數:31,代碼來源:mainsearch_strings.php


注:本文中的Strings::getSimilar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。