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


PHP report_results函數代碼示例

本文整理匯總了PHP中report_results函數的典型用法代碼示例。如果您正苦於以下問題:PHP report_results函數的具體用法?PHP report_results怎麽用?PHP report_results使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: main

function main()
{
    if (strcmp('4.1.0', phpversion()) > 0) {
        die("Error: PHP version 4.1.0 or above required!");
    }
    if (!($file = fopen("search.idx", "rb"))) {
        die("Error: Search index file could NOT be opened!");
    }
    if (readHeader($file) != "DOXS") {
        die("Error: Header of index file is invalid!");
    }
    $query = "";
    if (array_key_exists("query", $_GET)) {
        $query = $_GET["query"];
    }
    echo "<input class=\"search\" type=\"text\" name=\"query\" value=\"{$query}\" size=\"20\" accesskey=\"s\"/>\n";
    echo "</span>\n";
    echo "</form>\n";
    echo "</div>\n";
    $results = array();
    $requiredWords = array();
    $forbiddenWords = array();
    $foundWords = array();
    $word = strtok($query, " ");
    while ($word) {
        if ($word[0] == '+') {
            $word = substr($word, 1);
            $requiredWords[] = $word;
        }
        if ($word[0] == '-') {
            $word = substr($word, 1);
            $forbiddenWords[] = $word;
        }
        if (!in_array($word, $foundWords)) {
            $foundWords[] = $word;
            search($file, $word, $results);
        }
        $word = strtok(" ");
    }
    $docs = array();
    combine_results($results, $docs);
    // filter out documents with forbidden word or that do not contain
    // required words
    $filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
    // sort the results based on rank
    $sorted = array();
    sort_results($filteredDocs, $sorted);
    // report results to the user
    report_results($sorted);
    fclose($file);
}
開發者ID:ninghang,項目名稱:bayesianPlay,代碼行數:51,代碼來源:search.php

示例2: search

function search()
{
    if (strcmp('4.1.0', phpversion()) > 0) {
        die("Error: PHP version 4.1.0 or above required!");
    }
    $paths = paths();
    $files = array();
    $j = 0;
    for ($i = 0; $i < sizeof($paths); $i++) {
        if (!($f = @fopen($paths[$i] . "search.idx", "rb"))) {
            die("Error: Search index file could NOT be opened!");
            continue;
        }
        $files[$j++] = $f;
        if (readHeader($f) != "DOXS") {
            die("Error: Header of index file is invalid!");
        }
    }
    $query = "";
    if (array_key_exists("query", $_GET)) {
        $query = $_GET["query"];
    }
    //end_form($query);
    echo "&nbsp;\n<div class=\"searchresults\">\n";
    $results = array();
    $requiredWords = array();
    $forbiddenWords = array();
    $foundWords = array();
    $word = strtok($query, " ");
    while ($word) {
        if ($word[0] == '+') {
            $word = substr($word, 1);
            $requiredWords[] = $word;
        }
        if ($word[0] == '-') {
            $word = substr($word, 1);
            $forbiddenWords[] = $word;
        }
        if (!in_array($word, $foundWords)) {
            $foundWords[] = $word;
            for ($i = 0; $i < sizeof($files); $i++) {
                do_search($paths[$i], $files[$i], strtolower($word), $results);
            }
        }
        $word = strtok(" ");
    }
    $docs = array();
    combine_results($results, $docs);
    // filter out documents with forbidden word or that do not contain
    // required words
    $filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
    // sort the results based on rank
    $sorted = array();
    sort_results($filteredDocs, $sorted);
    // report results to the user
    report_results($sorted);
    echo "</div>\n";
    foreach ($files as $file) {
        fclose($file);
    }
}
開發者ID:BackupTheBerlios,項目名稱:senf-svn,代碼行數:61,代碼來源:search_functions.php

示例3: main

function main()
{
    if (strcmp('4.1.0', phpversion()) > 0) {
        die("Error: PHP version 4.1.0 or above required!");
    }
    if (!($file = fopen("search.idx", "rb"))) {
        die("Error: Search index file could NOT be opened!");
    }
    if (readHeader($file) != "DOXS") {
        die("Error: Header of index file is invalid!");
    }
    $query = "";
    if (array_key_exists("query", $_GET)) {
        $query = $_GET["query"];
    }
    end_form(ereg_replace("[^[:alnum:]:\\.\\t ]", " ", $query));
    echo "&nbsp;\n<div class=\"searchresults\">\n";
    $results = array();
    $requiredWords = array();
    $forbiddenWords = array();
    $foundWords = array();
    $word = strtok($query, " ");
    while ($word) {
        if ($word[0] == '+') {
            $word = substr($word, 1);
            $requiredWords[] = $word;
        }
        if ($word[0] == '-') {
            $word = substr($word, 1);
            $forbiddenWords[] = $word;
        }
        if (!in_array($word, $foundWords)) {
            $foundWords[] = $word;
            search($file, strtolower($word), $results);
        }
        $word = strtok(" ");
    }
    $docs = array();
    combine_results($results, $docs);
    // filter out documents with forbidden word or that do not contain
    // required words
    $filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
    // sort the results based on rank
    $sorted = array();
    sort_results($filteredDocs, $sorted);
    // report results to the user
    report_results($sorted);
    echo "</div>\n";
    fclose($file);
}
開發者ID:kobkob,項目名稱:ta,代碼行數:50,代碼來源:search.php

示例4: main

function main($idxfile)
{
    if (strcmp('4.1.0', phpversion()) > 0) {
        die("Error: PHP version 4.1.0 or above required!");
    }
    if (!($file = fopen($idxfile, "rb"))) {
        die("Error: Search index file could NOT be opened!");
    }
    if (readHeader($file) != "DOXS") {
        die("Error: Header of index file is invalid!");
    }
    $query = "";
    if (array_key_exists("query", $_GET)) {
        $query = $_GET["query"];
    }
    $results = array();
    $requiredWords = array();
    $forbiddenWords = array();
    $foundWords = array();
    $word = strtolower(strtok($query, " "));
    while ($word) {
        if ($word[0] == '+') {
            $word = substr($word, 1);
            $requiredWords[] = $word;
        }
        if ($word[0] == '-') {
            $word = substr($word, 1);
            $forbiddenWords[] = $word;
        }
        if (!in_array($word, $foundWords)) {
            $foundWords[] = $word;
            search($file, $word, $results);
        }
        $word = strtolower(strtok(" "));
    }
    $docs = array();
    combine_results($results, $docs);
    // filter out documents with forbidden word or that do not contain
    // required words
    $filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
    // normalize rankings so they are in the range [0-100]
    normalize_ranking($filteredDocs);
    // sort the results based on rank
    $sorted = array();
    sort_results($filteredDocs, $sorted);
    // report results to the user
    report_results($sorted);
    fclose($file);
}
開發者ID:jimeiyang,項目名稱:deepRotator,代碼行數:49,代碼來源:doxysearch.php


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