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


PHP between函数代码示例

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


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

示例1: index

 /**
  * @return mixed
  */
 public function index()
 {
     if (Input::has('folder')) {
         $username = request('user', auth()->id());
         $entity = $this->folders->getByName($username, request('folder'));
     } else {
         $groupName = request('group', 'all');
         $entity = $this->groups->requireByName($groupName);
     }
     $type = request('type', 'all');
     $canSortBy = ['comments', 'uv', 'created_at', 'frontpage_at'];
     $orderBy = in_array(request('sort'), $canSortBy) ? request('sort') : null;
     $builder = $entity->contents($type, $orderBy)->with('group', 'user');
     // Time filter
     $time = request('time');
     if ($time) {
         $builder->fromDaysAgo($time);
     }
     // Domain filter
     $domain = request('domain');
     if ($domain) {
         $builder->where('domain', $domain);
     }
     // User filter
     if (Input::has('user')) {
         $user = User::name(request('user'))->firstOrFail();
         $builder->where('user_id', $user->getKey());
     }
     $perPage = Input::has('per_page') ? between(request('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
开发者ID:strimoid,项目名称:strimoid,代码行数:34,代码来源:ContentController.php

示例2: time_ago_in_words

function time_ago_in_words($time)
{
    $from_time = strtotime($time);
    $to_time = strtotime(gmd());
    $distance_in_minutes = round(($to_time - $from_time) / 60);
    if ($distance_in_minutes < 0) {
        return (string) $distance_in_minutes . 'E';
    }
    if (between($distance_in_minutes, 0, 1)) {
        return '1 minute';
    } elseif (between($distance_in_minutes, 2, 44)) {
        return $distance_in_minutes . ' minutes';
    } elseif (between($distance_in_minutes, 45, 89)) {
        return '1 hour';
    } elseif (between($distance_in_minutes, 90, 1439)) {
        return round($distance_in_minutes / 60) . ' hours';
    } elseif (between($distance_in_minutes, 1440, 2879)) {
        return '1 day';
    } elseif (between($distance_in_minutes, 2880, 43199)) {
        return round($distance_in_minutes / 1440) . ' days';
    } elseif (between($distance_in_minutes, 43200, 86399)) {
        return '1 month';
    } elseif (between($distance_in_minutes, 86400, 525959)) {
        return round($distance_in_minutes / 43200) . ' months';
    } elseif ($distance_in_minutes > 525959) {
        return number_format(round($distance_in_minutes / 525960, 1), 1) . ' years';
    }
}
开发者ID:laiello,项目名称:my-imouto-booru,代码行数:28,代码来源:application_helper.php

示例3: index

 public function index()
 {
     $folderName = Input::get('folder');
     $groupName = Input::has('group') ? shadow(Input::get('group')) : 'all';
     $className = 'Strimoid\\Models\\Folders\\' . studly_case($folderName ?: $groupName);
     if (Input::has('folder') && !class_exists('Folders\\' . studly_case($folderName))) {
         $user = Input::has('user') ? User::findOrFail(Input::get('user')) : Auth::user();
         $folder = Folder::findUserFolderOrFail($user->getKey(), Input::get('folder'));
         if (!$folder->public && (Auth::guest() || $user->getKey() != Auth::id())) {
             App::abort(404);
         }
         $builder = $folder->entries();
     } elseif (class_exists($className)) {
         $fakeGroup = new $className();
         $builder = $fakeGroup->entries();
         $builder->orderBy('sticky_global', 'desc');
     } else {
         $group = Group::name($groupName)->firstOrFail();
         $group->checkAccess();
         $builder = $group->entries();
         // Allow group moderators to stick contents
         $builder->orderBy('sticky_group', 'desc');
     }
     $builder->with(['user', 'group', 'replies', 'replies.user'])->orderBy('created_at', 'desc');
     $perPage = Input::has('per_page') ? between(Input::get('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
开发者ID:rafamontufar,项目名称:Strimoid,代码行数:27,代码来源:EntryController.php

示例4: singleDisplay

 public function singleDisplay($name, Request $request)
 {
     dd($request->getRequestUri());
     $product = between("/", "/", $request->getRequestUri());
     $data = Category::getSingleItem($name);
     // dd($data);
     return view('product_display.single', ['data' => $data, 'config' => ['route' => "/{$product}/{$name}", 'header' => $name]]);
 }
开发者ID:shegun-babs,项目名称:dakrush,代码行数:8,代码来源:ProductDisplayController.php

示例5: namesArtist

function namesArtist($r)
{
    $pubd = array();
    foreach ($r['hits']['hits'] as $ev) {
        array_push($pubd, between('Artiste :', 'Matériaux :', $ev['_source']['pubDate']));
    }
    return $pubd;
}
开发者ID:ridaovic,项目名称:VosArtistes,代码行数:8,代码来源:search.php

示例6: offset

 /**
  * How far to separate the slice from the rest of the pie.
  * from 0.0 (not at all) to 1.0 (the pie's radius).
  *
  * @param float offset
  * @return \slice
  */
 public function offset($offset)
 {
     if (is_float($offset) && between($offset, 0.0, 1.0)) {
         $this->offset = $offset;
     } else {
         $this->type_error(__FUNCTION__, 'float', 'where 0.0 < $offset < 0.1');
     }
     return $this;
 }
开发者ID:melanialani,项目名称:admin,代码行数:16,代码来源:slice.php

示例7: index

 private function index($data, $db, $sdb)
 {
     $data = str_get_html($data);
     foreach ($data->find('.even, .odd') as $result) {
         $title = $result->find('.cellMainLink', 0)->plaintext;
         $url = 'https://kat.cr' . $result->find('.cellMainLink', 0)->href;
         $m = $result->find('div.iaconbox', 0);
         $hash = strtoupper(between($m, 'magnet:?xt=urn:btih:', '&dn='));
         $size = round(strToBytes($result->find('td.nobr', 0)->plaintext) / 1024);
         $seeds = $result->find('td.green', 0)->plaintext;
         $peers = $result->find('td.red', 0)->plaintext;
         $date = strtotime($result->find('td', 3)->title);
         $uploader = $result->find('a.plain', 1)->plaintext;
         $files = $result->find('td', 2)->plaintext;
         if (!$result->find('span.block')) {
             continue;
         }
         $cdata = $result->find('span.block', 0)->find('strong', 0)->plaintext;
         if (strstr($cdata, 'Movies')) {
             $type = 'movies';
         } elseif (strstr($cdata, 'Games')) {
             $type = 'games';
         } elseif (strstr($cdata, 'Music')) {
             $type = 'music';
         } elseif (strstr($cdata, 'Applications')) {
             $type = 'software';
         } elseif (strstr($cdata, 'TV')) {
             $type = 'tv';
         } elseif (strstr($cdata, 'XXX')) {
             $type = 'porn';
         } elseif (strstr($cdata, 'Anime')) {
             $type = 'anime';
         } elseif (strstr($cdata, 'Books')) {
             $type = 'books';
         } else {
             $type = 'other';
         }
         $type = Rivr::getType($type);
         $cdate = time();
         $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;");
         if ($query->num_rows) {
             $this->updated++;
             $info = $query->fetch_assoc();
             Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         } else {
             $this->added++;
             Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         }
     }
     $data->clear();
     unset($data);
 }
开发者ID:algoprog,项目名称:rivr-search,代码行数:52,代码来源:kickass.indexer.php

示例8: organizer_check_collision

function organizer_check_collision($frame, $date, $events)
{
    $collidingevents = array();
    foreach ($events as $event) {
        $framefrom = $frame['from'] + $date;
        $frameto = $frame['to'] + $date;
        $eventfrom = $event->timestart;
        $eventto = $eventfrom + $event->timeduration;
        if (between($framefrom, $eventfrom, $eventto) || between($frameto, $eventfrom, $eventto) || between($eventfrom, $framefrom, $frameto) || between($eventto, $framefrom, $frameto) || $framefrom == $eventfrom || $eventfrom == $eventto) {
            $collidingevents[] = $event;
        }
    }
    return $collidingevents;
}
开发者ID:miotto,项目名称:moodle-mod_organizer,代码行数:14,代码来源:locallib.php

示例9: pick_from_list

/**
 * Present a list of choices to user, return choice
 * @param Command $command The command requesting input
 * @param array $choices List of choices
 * @param int $default Default choice (1-array size), -1 to abort
 * @param string $abort String to tag on end for aborting selection
 * @return int -1 if abort selected, otherwise one greater than $choice index
 *        (in other words, choosing $choice[0] returns 1)
 * @throws InvalidArgumentException If argument is invalid
 */
function pick_from_list(Command $command, $title, array $choices, $default = 0, $abort = null)
{
    if ($abort) {
        $choices[] = $abort;
    }
    $numChoices = count($choices);
    if (!$numChoices) {
        throw new \InvalidArgumentException("Must have at least one choice");
    }
    if ($default == -1 && empty($abort)) {
        throw new \InvalidArgumentException('Cannot use default=-1 without $abort option');
    }
    if (!between($default, -1, $numChoices)) {
        throw new \InvalidArgumentException("Invalid value, default={$default}");
    }
    $question = "Please enter a number between 1-{$numChoices}";
    if ($default > 0) {
        $question .= " (default is {$default})";
    } elseif ($default < 0) {
        $question .= " (enter to abort)";
        $default = $numChoices;
    }
    $question .= ':';
    while (1) {
        $command->line('');
        $command->info($title);
        $command->line('');
        for ($i = 0; $i < $numChoices; $i++) {
            $command->line($i + 1 . ". " . $choices[$i]);
        }
        $command->line('');
        $answer = $command->ask($question);
        if ($answer == '') {
            $answer = $default;
        }
        if (between($answer, 1, $numChoices)) {
            if ($abort and $answer == $numChoices) {
                $answer = -1;
            }
            return (int) $answer;
        }
        // Output wrong choice
        $command->line('');
        $formatter = $command->getHelperSet()->get('formatter');
        $block = $formatter->formatBlock('Invalid entry!', 'error', true);
        $command->line($block);
    }
}
开发者ID:tashakau,项目名称:getting-stuff-done-laravel-code,代码行数:58,代码来源:helpers.php

示例10: index

 public function index()
 {
     if (Input::has('folder')) {
         $username = request('user', auth()->id());
         $entity = $this->folders->getByName($username, request('folder'));
     } else {
         $groupName = request('group', 'all');
         $entity = $this->groups->getByName($groupName);
     }
     $sortBy = in_array(request('sort'), ['uv', 'created_at']) ? request('sort') : 'created_at';
     $builder = $entity->comments($sortBy)->with(['user', 'group', 'replies', 'replies.user']);
     // Time filter
     if (Input::has('time')) {
         $builder->fromDaysAgo(request('time'));
     }
     $perPage = Input::has('per_page') ? between(request('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
开发者ID:strimoid,项目名称:strimoid,代码行数:18,代码来源:CommentController.php

示例11: fetchPPTs

 protected function fetchPPTs($dataTag2, $delimiter1, $delimiter2)
 {
     $ppts = [];
     $i = 0;
     foreach ($this->rawHtml->find($dataTag2) as $element) {
         $long_name = $this->textCaptions[$i];
         $dimensions = between($delimiter1, $delimiter2, $long_name);
         $this->_name[$i] = trim(between($delimiter1, $delimiter2, $long_name));
         $this->type[$i] = strtoupper($this->_name[$i]);
         $this->length[$i] = $this->replaceString(trim(str_take(5, $dimensions)));
         $this->width[$i] = $this->replaceString(trim(str_rtake(6, $dimensions)));
         $this->thickness[$i] = NULL;
         $this->_description[$i] = $this->_name[$i] . ' (' . $this->length[$i] . 'X' . $this->width[$i] . ')';
         dd($this->_name[$i], $this->length[$i], $this->width[$i], $this->thickness[$i]);
         $this->remoteImgUrl[$i] = $element->{"data-orig-file"};
         $ext = after_last(".", $this->remoteImgUrl[$i]);
         $this->photoName[$i] = sprintf("%s-%s", time(), create_slug(str_replace(":", "-", $this->_name[$i])) . ".{$ext}");
         $this->photoPath[$i] = sprintf("%s/%s", self::imgBasePath, $this->photoName[$i]);
         $this->photoTPath[$i] = sprintf("%s/tn-%s", self::imgBasePath, $this->photoName[$i]);
         $i++;
     }
 }
开发者ID:shegun-babs,项目名称:dakrush,代码行数:22,代码来源:GrabDataFromSource.php

示例12: fddbSuche

function fddbSuche($gtin)
{
    //$gtin = "4388844009943";
    $gtin = preg_replace('/[^0-9]+/', '', $gtin);
    $data = curlData("http://fddb.mobi/search/?lang=de&cat=mobile-de&search=" . $gtin);
    $resultblock = between("<!-- %sresultblock% //-->", "<!-- %eresultblock% //-->", $data);
    $link = between("window.location.href = '", "';", $data);
    $area = between("<b>100 g:</b>", "<b>1 Packung:</b>", $data);
    if ($link != false && strlen($gtin) >= 13) {
        $werte = array("energy" => preg_replace('/[^0-9,.]+/', '', before("(", $area)), "calories" => preg_replace('/[^0-9,.]+/', '', between("(", ")", $area)), "fat" => preg_replace('/[^0-9,.]+/', '', between("Fett: ", "KH:", $area)), "carbonhydrate" => preg_replace('/[^0-9,.]+/', '', between("KH: ", "<br>", $area)));
        //$werte = array("Energie", "Energie1", "Fett", "Kohlenhydrate");
        $naerhwerte = "";
        foreach ($werte as $key => $value) {
            $naerhwerte[$key]["value"] = preg_replace('/[^0-9]+/', '', $werte[$key]);
            $naerhwerte[$key]["currencie"] = preg_replace('/[^a-zA-Z]+/', '', $werte[$key]);
        }
        $result = array("sourecName" => "fddb", "link" => $link, "gtin" => $gtin, "nutriTable" => $werte, "titel" => between("<a href='" . $link . "'><b>", '</b></a>', $resultblock));
        $graph = new EasyRdf_Graph();
        $namespace = new EasyRdf_Namespace();
        $namespace->set('rezept', "http://manke-hosting.de/ns-syntax#");
        buildTree($graph, $result["link"], $result, 'rezept');
        echo $graph->serialise("turtle");
    }
}
开发者ID:RaphaelManke,项目名称:chefkochWrapperToRDF,代码行数:24,代码来源:fddbSuche.php

示例13: testBetweenExceptionel2

 public function testBetweenExceptionel2()
 {
     $this->assertEquals("", between("DESCRIPTION:", "ipsum", ""));
 }
开发者ID:supernoono,项目名称:EDT-IUT,代码行数:4,代码来源:DaoTest.php

示例14: notBetween

/**
 * @param int $min
 * @param int $max
 * @return \Closure
 */
function notBetween($min, $max)
{
    return negate(between($min, $max));
}
开发者ID:Giuseppe-Mazzapica,项目名称:Pentothal,代码行数:9,代码来源:size.php

示例15: array

$options = array('u1' => $u1, 'u2' => $u2, 'type' => $type, 'types' => array('posts', 'comments'));
echo '<div id="newswrap"><!-- between.php -->';
Haanga::Load('between.html', compact('options'));
if ($id1 > 0 && $id2 > 0) {
    $all = array();
    $to = array();
    $sorted = array();
    $rows = 0;
    if (isset($_GET['id']) && !empty($_GET['id'])) {
        $sorted = explode(',', @gzuncompress(@base64_decode($_GET['id'])));
        $show_thread = true;
    } else {
        $show_thread = false;
        $rows = -1;
        $to[0] = between($id1, $id2, $type, $prefix, $page_size, $offset);
        $to[1] = between($id2, $id1, $type, $prefix, $page_size, $offset);
        foreach ($to as $e) {
            foreach ($e as $k => $v) {
                $all[$k] = $v;
            }
        }
        $keys = array_keys($all);
        sort($keys, SORT_NUMERIC);
        foreach ($keys as $k) {
            $a = $all[$k];
            sort($a, SORT_NUMERIC);
            foreach ($a as $e) {
                if (!in_array($e, $sorted) && !in_array($e, $keys)) {
                    $sorted[] = $e;
                }
            }
开发者ID:manelio,项目名称:woolr,代码行数:31,代码来源:between.php


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