本文整理汇总了PHP中search函数的典型用法代码示例。如果您正苦于以下问题:PHP search函数的具体用法?PHP search怎么用?PHP search使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了search函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sphinx_helper
public function sphinx_helper()
{
$this->load->helper("sphinx");
$a = search_wrapper(search("", null, true, 5, 40));
//Obtiene todas las fichas
debug(implode(',', $a));
}
示例2: getDiscussionPages
/**
* returns a list of all discussion pages in the wiki
*/
function getDiscussionPages()
{
global $conf;
$data = array();
search($data, $conf['datadir'], 'search_discussionpages', array());
return $data;
}
示例3: search
function search($n)
{
global $number;
global $formula;
global $sentinels;
global $commutations;
if (1 == $n) {
if (abs($number[0] - 24) <= PRECISION) {
$fml = convertRPN2Infix($formula[0]);
if (check_exist($fml, $sentinels) && check_commutation($fml, $commutations)) {
$sentinels[] = $fml;
echo $fml;
echo "<br>";
return true;
} else {
return false;
}
} else {
return false;
}
} else {
for ($i = 0; $i < $n; $i++) {
for ($j = $i + 1; $j < $n; $j++) {
$a = $number[$i];
$b = $number[$j];
$number[$j] = $number[$n - 1];
$formula_a = $formula[$i];
$formula_b = $formula[$j];
$formula[$j] = $formula[$n - 1];
$formula[$i] = $formula_a . $formula_b . '+';
$number[$i] = $a + $b;
search($n - 1);
$formula[$i] = $formula_a . $formula_b . '-';
$number[$i] = $a - $b;
search($n - 1);
$formula[$i] = $formula_b . $formula_a . '-';
$number[$i] = $b - $a;
search($n - 1);
$formula[$i] = $formula_a . $formula_b . '*';
$number[$i] = $a * $b;
search($n - 1);
if ($b != 0) {
$formula[$i] = $formula_a . $formula_b . '/';
$number[$i] = $a / $b;
search($n - 1);
}
if ($a != 0) {
$formula[$i] = $formula_b . $formula_a . '/';
$number[$i] = $b / $a;
search($n - 1);
}
$number[$i] = $a;
$number[$j] = $b;
$formula[$i] = $formula_a;
$formula[$j] = $formula_b;
}
}
return false;
}
}
示例4: paginate
function paginate($page, $qa, $limit)
{
global $conn;
$offset = ($page - 1) * $limit;
$psql = search($offset, $limit, $qa);
return $psql->fetchAll(PDO::FETCH_ASSOC);
}
示例5: search
/**
* recurse direcory
*
* This function recurses into a given base directory
* and calls the supplied function for each file and directory
*
* @param array ref $data The results of the search are stored here
* @param string $base Where to start the search
* @param callback $func Callback (function name or arayy with object,method)
* @param string $dir Current directory beyond $base
* @param int $lvl Recursion Level
* @author Andreas Gohr <andi@splitbrain.org>
*/
function search(&$data, $base, $func, $opts, $dir = '', $lvl = 1)
{
$dirs = array();
$files = array();
//read in directories and files
$dh = @opendir($base . '/' . $dir);
if (!$dh) {
return;
}
while (($file = readdir($dh)) !== false) {
if (preg_match('/^[\\._]/', $file)) {
continue;
}
//skip hidden files and upper dirs
if (is_dir($base . '/' . $dir . '/' . $file)) {
$dirs[] = $dir . '/' . $file;
continue;
}
$files[] = $dir . '/' . $file;
}
closedir($dh);
sort($files);
sort($dirs);
//give directories to userfunction then recurse
foreach ($dirs as $dir) {
if (call_user_func_array($func, array(&$data, $base, $dir, 'd', $lvl, $opts))) {
search($data, $base, $func, $opts, $dir, $lvl + 1);
}
}
//now handle the files
foreach ($files as $file) {
call_user_func_array($func, array(&$data, $base, $file, 'f', $lvl, $opts));
}
}
示例6: getTree
/**
* get a list of namespace / page files
*
* @param string $folder an already converted filesystem folder of the current namespace
*/
function getTree($folder = ':')
{
global $conf;
global $ID;
// read tree structure from pages and media
$ofolder = $folder;
if ($folder == '*' || $folder == '') {
$folder = ':';
}
if ($folder[0] != ':') {
$folder = resolve_id($folder, $ID);
}
$dir = strtr(cleanID($folder), ':', '/');
if (!($this->cache() && is_array($data = $this->cache()->get('explorertree_cache_' . $dir)))) {
$data = array();
search($data, $conf['datadir'], 'search_index', array('ns' => getNS($ID)), $dir, $dir == '' ? 1 : count(explode('/', $dir)) + 1);
$count = count($data);
if ($count > 0) {
for ($i = 1; $i < $count; $i++) {
if ($data[$i - 1]['id'] == $data[$i]['id'] && $data[$i - 1]['type'] == $data[$i]['type']) {
unset($data[$i]);
$i++;
// duplicate found, next $i can't be a duplicate, so skip forward one
}
}
}
if ($this->cache()) {
$this->cache()->set($cache_id = 'explorertree_cache_' . $dir, $data, 60);
// store the data itself (cache for one minute)
}
}
return $data;
}
示例7: content
function content($page, $count = 0)
{
global $langmessage, $menu, $message, $prefix, $out;
$out = "";
if ($message != "") {
$out .= "<div class=\"LNE_message\">" . $message . "</div>\n";
}
switch ($_GET['do']) {
case "search":
$out .= "<h2 class=\"LNE_title\">{$langmessage['66']}</h2>\n";
search(true);
break;
case "profile":
$out .= profile();
break;
case "sitemap":
$out .= showsitemap($langmessage, 1);
break;
case "login":
$out .= loginform();
break;
default:
$result = dbquery('SELECT * FROM ' . $prefix . 'paginas WHERE page="' . $page . '"');
$row = fetch_array($result);
if ($row['restricted'] != 0 && $row['restricted'] > $_SESSION['adminlevel']) {
$out .= restrictedpage($row['restricted']);
} else {
$out .= markers(stripslashes(html_entity_decode($row['content'])));
}
}
print $out;
}
示例8: search
function search($n)
{
global $number;
global $formula;
global $sentinels;
if (1 == $n) {
if (abs($number[0] - 24) <= PRECISION) {
$fml = escape_brackets($formula[0]);
if (check_exist($fml, $sentinels)) {
$sentinels[] = $fml;
print_formula($fml);
var_dump($fml);
echo "<br>";
return true;
} else {
return false;
}
} else {
return false;
}
} else {
for ($i = 0; $i < $n; $i++) {
for ($j = $i + 1; $j < $n; $j++) {
$a = $number[$i];
$b = $number[$j];
$number[$j] = $number[$n - 1];
$formula_a = $formula[$i];
$formula_b = $formula[$j];
$formula[$j] = $formula[$n - 1];
$formula[$i] = $formula_a . $formula_b . '+';
$number[$i] = $a + $b;
search($n - 1);
$formula[$i] = $formula_a . $formula_b . '-';
$number[$i] = $a - $b;
search($n - 1);
$formula[$i] = $formula_b . $formula_a . '-';
$number[$i] = $b - $a;
search($n - 1);
$formula[$i] = $formula_a . $formula_b . '*';
$number[$i] = $a * $b;
search($n - 1);
if ($b != 0) {
$formula[$i] = $formula_a . $formula_b . '/';
$number[$i] = $a / $b;
search($n - 1);
}
if ($a != 0) {
$formula[$i] = $formula_b . $formula_a . '/';
$number[$i] = $b / $a;
search($n - 1);
}
$number[$i] = $a;
$number[$j] = $b;
$formula[$i] = $formula_a;
$formula[$j] = $formula_b;
}
}
return false;
}
}
示例9: printFilter
function printFilter()
{
?>
<form method="GET">
<div class="banner-filter">Recherche</div>
<div class="content-filter"><?php
search();
?>
</div>
<div class="banner-filter">Zones</div>
<div class="content-filter"><?php
masterZoneDropDown();
?>
</div>
<div class="banner-filter">Types</div>
<div class="content-filter"><?php
printCheckBox('buy', 'A acheter');
printCheckBox('catch', 'A capturer');
printCheckBox('own', 'Possédé');
?>
</div>
<div class="banner-filter">Trier par</div>
<div class="content-filter"><?php
printSortRadio('priceAsc', 'Prix croissant');
printSortRadio('priceDesc', 'Prix décroissant');
printSortRadio('name', 'Nom');
printSortRadio('zoneFilter', 'Zone');
?>
</div>
<input class="button-filter" type="submit" value="Filtrer">
</form><?php
}
示例10: getAllPages
function getAllPages()
{
$namespace = $this->getConf("translationns");
$dir = dirname(wikiFN("{$namespace}:foo"));
$pages = array();
search($pages, $dir, 'search_allpages', array());
return $pages;
}
示例11: searchFiles
private function searchFiles()
{
global $conf;
$opt = array('depth' => $this->data['maxDepth'], 'keeptxt' => false, 'listfiles' => !$this->data['nopages'], 'listdirs' => $this->data['subns'], 'pageonly' => true, 'skipacl' => false, 'sneakyacl' => true, 'hash' => false, 'meta' => false, 'showmsg' => false, 'showhidden' => false, 'firsthead' => true);
$files = array();
search($files, $conf['datadir'], 'search_universal', $opt, $this->data['wantedDir']);
return $files;
}
示例12: ajax_pagelist
/**
* Searches for pages
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_pagelist(){
global $conf;
$data = array();
search($data,$conf['datadir'], 'search_allpages', array());
foreach($data as $val) {
print $val['id']."\n";
}
}
示例13: combinedArrays
function combinedArrays($firstArray, $secondArray)
{
foreach ($secondArray as $query) {
if (!search($query, $firstArray)) {
array_push($firstArray, $query);
}
}
print_r($firstArray);
}
示例14: query_api
/**
* Queries the API by the input values from the user
*
* @param $term The search term to query
* @param $location The location of the business to query
*/
function query_api($term, $location)
{
$response = json_decode(search($term, $location));
$business_id = $response->businesses[0]->id;
print sprintf("%d businesses found, querying business info for the top result \"%s\"\n\n", count($response->businesses), $business_id);
$response = get_business($business_id);
print sprintf("Result for business \"%s\" found:\n", $business_id);
print "{$response}\n";
}
示例15: get_suggestions_complex
function get_suggestions_complex($q, $base_tabl, $field, $select, $field_fetch)
{
$sql = search($q, $base_tabl, $field, $select);
$rsd = mysql_query($sql) or die(mysql_error());
while ($rs = mysql_fetch_assoc($rsd)) {
$result .= $rs[$field_fetch] . "\n";
}
return $result;
}