• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP tail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: readConfig

/**
 * @param array $files Configuration files, from lowest to highest precedence.
 * @return array An associative array mapping config variables to respective values.
 */
function readConfig(array $files)
{
    if (count($files) == 0) {
        return array();
    } else {
        return array_merge(parse_ini_file(head($files)), readConfig(tail($files)));
    }
}
开发者ID:JustAHappyKid,项目名称:bitcoin-chipin,代码行数:12,代码来源:init.php


示例2: partial

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @param callable $fn
 *
 * @return mixed
 */
function partial(callable $fn)
{
    $args = tail(func_get_args());
    $numRequiredParams = (new \ReflectionFunction($fn))->getNumberOfRequiredParameters();
    return function () use($fn, $args, $numRequiredParams) {
        $args = array_merge($args, func_get_args());
        if ($numRequiredParams > count($args)) {
            return call_user_func_array(partial, array_merge([$fn], $args));
        }
        return call_user_func_array($fn, $args);
    };
}
开发者ID:sergiors,项目名称:functional,代码行数:19,代码来源:partial.php


示例3: sort

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @param array $xss
 *
 * @return array
 */
function sort(array $xss)
{
    $xss = array_values($xss);
    if (!has(1, $xss)) {
        return $xss;
    }
    $pivot = head($xss);
    $xs = tail($xss);
    $left = array_filter($xs, function ($x) use($pivot) {
        return $x < $pivot;
    });
    $right = array_filter($xs, function ($x) use($pivot) {
        return $x > $pivot;
    });
    return array_merge(sort($left), [$pivot], sort($right));
}
开发者ID:sergiors,项目名称:functional,代码行数:23,代码来源:sort.php


示例4: takewhile

/**
 * @author Marcelo Camargo <[email protected]>
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return array
 */
function takewhile()
{
    $args = func_get_args();
    $takewhile = function (callable $condition, array $xss) {
        if ([] === $xss) {
            return [];
        }
        $head = head($xss);
        $tail = tail($xss);
        if ($condition($head)) {
            return array_merge([$head], takewhile($condition, $tail));
        }
        return [];
    };
    return call_user_func_array(partial($takewhile), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:22,代码来源:takewhile.php


示例5: dropwhile

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return array
 */
function dropwhile()
{
    $args = func_get_args();
    $dropwhile = function (callable $condition, array $xss) {
        if ([] === $xss) {
            return [];
        }
        $head = head($xss);
        $tail = tail($xss);
        if ($condition($head)) {
            return dropwhile($condition, $tail);
        }
        return $xss;
    };
    return call_user_func_array(partial($dropwhile), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:21,代码来源:dropwhile.php


示例6: live_chat_load_events

function live_chat_load_events($options)
{
    $tail['filename'] = LIVE_CHAT_STORAGE_PATH . $options['type'] . '/' . $options['reference_id'];
    $tail['line_count'] = LIVE_CHAT_MAX_READ_LINES;
    $tail['buffer_length'] = LIVE_CHAT_STORAGE_BUFFER_LENGTH;
    $options['min_id'] = isset($options['min_id']) ? $options['min_id'] : 0;
    $rows = tail($tail);
    $events = array();
    foreach ($rows as $row) {
        $event = unserialize(trim($row));
        if ($event['id'] > $options['min_id']) {
            $event['message'] = clickable_links($event['message']);
            $event['message'] = setsmilies($event['message']);
            $events[] = $event;
        }
    }
    return $events;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:18,代码来源:live_chat.lib.php


示例7: changeComplete

function changeComplete($type = "Information", $note = "")
{
    session_destroy();
    head();
    ?>
	<section><div class="container">
		<h1><?php 
    echo $type;
    ?>
 Changed!</h1>
		<p>Success! Please re-login to continue.</p>
		<p><?php 
    echo $note;
    ?>
</p>
	</div></section>
	<?php 
    tail();
    die;
}
开发者ID:BBKolton,项目名称:EXCO,代码行数:20,代码来源:preferences.php


示例8: setData

function setData($DATABASE)
{
    $db = new DB();
    $values = [];
    foreach ($_POST as $value) {
        array_push($values, $db->quote($value));
    }
    $valuesString = "(" . implode(", ", $values) . ")";
    $db->query("INSERT INTO " . $DATABASE . ".feedback \n\t\t              (type, text, email) \n\t\t              VALUES " . $valuesString);
    head();
    ?>

		<div class="container">
			<h1>Thank you for your feedback!</h1>
			<p>Your feedback has been successfuly saved.</p>
		</div>

		<?php 
    tail();
    die;
}
开发者ID:BBKolton,项目名称:EXCO,代码行数:21,代码来源:feedback.php


示例9: verifyUser

function verifyUser($email, $code, $DATABASE)
{
    $db = new DB();
    $exists = $db->select("SELECT * \n\t                         FROM " . $DATABASE . ".users \n\t                         WHERE email = " . $db->quote($email) . " AND activation = " . $db->quote($code));
    if (empty($exists[0])) {
        error("Invalid Verification", "Your verification is invalid. You might already be verified.");
    } else {
        //TODO this is copied into preferences for updateing email
        if (preg_match("/((@uw\\.edu)|(@u\\.washington\\.edu))/i", $exists[0]["email"])) {
            $netid = substr($exists[0]["email"], 0, strpos($exists[0]["email"], "@"));
            $db->query("UPDATE " . $DATABASE . ".users\n\t\t\t              SET activation = '1', netid = " . $db->quote($netid) . " WHERE email = " . $db->quote($email));
        } else {
            $db->query("UPDATE " . $DATABASE . ".users\n\t\t\t              SET activation = '1', netid = NULL\n\t\t\t              WHERE email = " . $db->quote($email));
        }
        head();
        ?>
		<section class="content">
			<div class="container">
				<h1>Success!</h1>
				<p>You are now verified with the Experimental College! 
				Sign up for some classes!</p>
			</div>
		</section>
		<?php 
        tail();
    }
}
开发者ID:BBKolton,项目名称:EXCO,代码行数:27,代码来源:registeruser.php


示例10: tail

echo $lines == '100' ? 'selected' : '';
?>
>100</option>
		<option value="500" <?php 
echo $lines == '500' ? 'selected' : '';
?>
>500</option>
</select>
</form></p>
        </div>

        <div class="content">

<code><pre style="font-size:14px;font-family:monospace;color:black;white-space: inherit"><ol reversed>
<?php 
$output = tail($file, $lines);
$output = explode("\n", $output);
if (DISPLAY_REVERSE) {
    // Latest first
    $output = array_reverse($output);
}
foreach ($output as $out) {
    if (trim($out) != '') {
        echo '<li>' . htmlspecialchars($out) . '</li>';
    }
}
?>
</ol></pre>
	</code>
<footer>
<p> berndklaus.at Log-Parser </p>
开发者ID:Berndinox,项目名称:Codiad-Logger-master,代码行数:31,代码来源:index.php


示例11: benchTail

 public function benchTail()
 {
     return tail($this->words());
 }
开发者ID:equip,项目名称:assist,代码行数:4,代码来源:ArrayBench.php


示例12: loadchat

function loadchat($name)
{
    $file = CHATDIR . $name . '.log';
    if (!file_exists($file)) {
        file_put_contents($file, "");
    }
    // UTF-8 BOM Support
    $line = tail($file, 5);
    return nl2br($line);
}
开发者ID:jdiperla,项目名称:text-adventure-engine,代码行数:10,代码来源:FileDriver.php


示例13: make

<?php

/*
 * This file is part of the async generator runtime project.
 *
 * (c) Julien Bianchi <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
require_once __DIR__ . '/../../vendor/autoload.php';
use function jubianchi\async\loop\{endless};
use function jubianchi\async\pipe\{make};
use function jubianchi\async\runtime\{await, all};
use function jubianchi\async\socket\{write};
use function jubianchi\async\stream\{tail};
$pipe = make();
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, 0, $argv[1]);
socket_set_nonblock($socket);
await(all(tail(fopen(__DIR__ . '/../data/first.log', 'r'), $pipe), tail(fopen(__DIR__ . '/../data/second.log', 'r'), $pipe), endless(function () use($socket, $pipe) {
    $data = (yield from $pipe->dequeue());
    yield from write($socket, $data);
})));
开发者ID:jubianchi,项目名称:async-generator,代码行数:24,代码来源:socket.php


示例14: sql_query

         $result_rows = sql_query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST" . $order_by);
         foreach ($result_rows as $row) {
             foreach ($row as $cell) {
                 if (stripos($cell, $filter) !== false) {
                     array_push($results, $row);
                     break;
                 }
             }
         }
     }
     // $actions = array("Kill" => "stuff"); /* for future implementation */
     $sorted = true;
     break;
 case "sqllogtransactions":
     if (isset($mysql_log_transactions) && isset($mysql_log_location) && file_exists($mysql_log_location) && is_readable($mysql_log_location)) {
         $data = tail($mysql_log_location, 1000);
         $lines = array();
         foreach (preg_split('/\\n/', $data) as $line) {
             $line = trim($line);
             if ($line == "") {
                 continue;
             }
             array_push($lines, $line);
         }
         for ($i = count($lines) - 1; $i >= 0; $i--) {
             if ($filter == "" || stripos($lines[$i], $filter) !== false) {
                 $entry = array("Tail" => count($lines) - $i, "Line" => $lines[$i]);
                 array_push($results, $entry);
             }
         }
     } else {
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:team_system_console.php


示例15: resetCompletePage

function resetCompletePage()
{
    session_start();
    session_destroy();
    //in case a user was logged in when they reset password
    head();
    ?>

		<section class="content">
			<div class="container">
				<h1>Password Reset!</h1>
				<p>Your password has been reset. Please 
				<a href="/asuwxpcl/users/login.php">login</a> to continue</p>
			</div>
		</section>

		<?php 
    tail();
}
开发者ID:BBKolton,项目名称:EXCO,代码行数:19,代码来源:forgot.php


示例16: tail

echo "</tr>\n";
echo "</table>\n";
echo "<br /><br />\n\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%'>\n";
echo "<b>Logs</b><br />\n";
//echo $v_log_dir.'/'.$v_name.".log<br /><br />\n";
echo "</td>\n";
echo "<td width='50%' align='right'>\n";
echo "  <input type='button' class='btn' value='download logs' onclick=\"document.location.href='v_status.php?a=download&t=logs';\" />\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n\n";
if (stristr(PHP_OS, 'WIN')) {
    //windows detected
    //echo "<b>tail -n 1500 ".$v_log_dir."/".$v_name.".log</b><br />\n";
    echo "<textarea id='log' name='log' style='width: 100%' rows='30' wrap='off'>\n";
    echo tail($v_log_dir . "/" . $v_name . ".log", 1500);
    echo "</textarea>\n";
} else {
    //windows not detected
    //echo "<b>tail -n 1500 ".$v_log_dir."/".$v_name.".log</b><br />\n";
    echo "<textarea id='log' name='log' style='width: 100%' rows='30' style='' wrap='off'>\n";
    echo system("tail -n 1500 " . $v_log_dir . "/" . $v_name . ".log");
    echo "</textarea>\n";
}
echo "<br /><br />\n\n";
echo "</td></tr></table>\n";
echo "</div>\n";
require_once "includes/footer.php";
开发者ID:petekelly,项目名称:fusionpbx,代码行数:31,代码来源:v_status.php


示例17: failed_password_check

function failed_password_check($errmesg, $authreqissuer)
{
    if (isset($authreqissuer)) {
        $return = "Location: " . $authreqissuer . '?error=' . urlencode($errmesg);
        header($return);
        /* Redirect browser */
    } else {
        header('HTTP/1.1 400 Bad Request');
        head("failed password authentication");
        print $errmesg . '<br/>';
        tail();
    }
    die;
}
开发者ID:akbarhossain,项目名称:webid4me,代码行数:14,代码来源:index.php


示例18: tail

    $mode_message_style = "altertnotice largerfont";
}
########
#################  Validate Input Files ##################
#####(note- these functions are also called earlier in this script, where status="Development" ######
######### Logfile display function call ##########
$logfile = "Pipeline_procedure";
# default id for jquery ui dialog element, 'Create' mode. Corresponds to logfile in path specified by xGDB_logfile.php
$logfile_path = "/xGDBvm/data/" . $DBid . "/logs/";
if ($Process_Type == "validate") {
    $logfile = "Validation";
    $logfile_path = "/xGDBvm/data/scratch/";
}
## Read last 3 lines of logfile in "Locked" mode only:
if ($Status == 'Locked') {
    $tail_logfile = tail($DBid, $logfile, $logfile_path);
    $tail_line1 = $tail_logfile[0];
    $tail_line2 = $tail_logfile[1];
}
$tail_display = $Status == 'Locked' ? "display_on" : "display_off";
######### hide Update parameters unless GDB is Current ########
$conditional_display = $Status == "Current" || $Update_Status == "Update" ? "" : "hidden";
######### In Current or Locked Config, hide GSQ, GTH Remote Job ID display text unless 'Remote' chosen ########
$conditional_gsq = $GSQ_CompResources == "Remote" && $Status != 'Development' ? "" : "display_off";
$conditional_gth = $GTH_CompResources == "Remote" && $Status != 'Development' ? "" : "display_off";
$conditional_dev = $Status == "Development" || $Update_Status == "Yes" ? "" : "display_off";
###### Directory Dropdowns and Mounted Volume Flags #######
# data directory:/data/ ($dir1)
$dir1_dropdown = "{$dataDir}";
// 1-26-16
if (file_exists("/xGDBvm/admin/iplant")) {
开发者ID:BrendelGroup,项目名称:xGDBvm,代码行数:31,代码来源:view.php


示例19: displayConfirmation

function displayConfirmation($db, $amount, $invoice)
{
    head();
    ?>

	<section class="content">
		<div class="container">
			<h1>Order Successful!</h1>
			<p>Thank you for taking classes with the Experimental College!
				You should receive an email shortly detailing the classes you applied for.
				Your order information is below.</p>
			<table>

				<?php 
    if ($_POST['type'] == 'credit') {
        ?>
 
					<tr>
						<td>Card Ending in: </td> 
						<td><?php 
        echo substr($_POST['card'], 12);
        ?>
</td>
					</tr>
					<tr>
						<td>Amount: </td>
						<td>$<?php 
        echo $amount;
        ?>
</td>
					</tr>
					<tr>
						<td>Invoice: </td>
						<td><?php 
        echo $invoice;
        ?>
</td>
					</tr>
				<?php 
    }
    ?>

				<tr>
					<td>Classes: </td>
					<td></td>
				</tr>

				<?php 
    for ($j = 0; $j < count($_SESSION["cart"]); $j += 2) {
        $course = $db->select("SELECT name FROM courses \n\t\t\t\t\t                       WHERE id = " . $db->quote($_SESSION["cart"][$j]))[0];
        ?>
					<tr>
						<td></td>
						<td><?php 
        echo $course["name"];
        ?>
</td>
					</tr>
				<?php 
    }
    ?>

			</table>
			<p>Head over to <a href="mycourses.php">my courses</a> at any time to view your
				currently enrolled sections</p>
		</div>
	</section>

	<?php 
    tail();
}
开发者ID:BBKolton,项目名称:EXCO,代码行数:71,代码来源:cartsubmit.php


示例20: draw_stats

function draw_stats()
{
    global $maxlines, $alog, $elog;
    # start timer
    $starttime = microtime(true);
    $out = "";
    # read query string (and display)
    if ($_GET && $_GET['module']) {
        $module = $_GET['module'];
        $out .= "<p>Usage Stats\n";
        $dispmod = preg_replace("/\\/modules\\//", "", $module);
    } else {
        # i don't understand why i wrote this bit:
        if (file_exists("../modules")) {
            $module = "/modules";
        } else {
            $module = "/";
        }
        $out .= "<p>Usage Stats\n";
        $dispmod = "";
    }
    $modmatch = preg_quote($module, "/");
    # our log file is overrun with stuff like battery check
    # requests -- we filter that here and create a temporary
    # log file instead...
    $tmpfile = "/media/RACHEL/filteredlog";
    $lagtime = 60;
    # seconds to refresh the filtered log
    if (!file_exists($tmpfile) || filemtime($tmpfile) < time() - $lagtime) {
        exec("grep -v 'GET /admin' {$alog} > {$tmpfile}");
    }
    # read in the log file
    $content = tail($tmpfile, $maxlines);
    # and process
    $nestcount = 0;
    $not_counted = 0;
    $total_pages = 0;
    while (1) {
        ++$nestcount;
        $count = 0;
        $errors = 0;
        # array();
        $stats = array();
        $start = "";
        foreach (preg_split("/((\r?\n)|(\r\n?))/", $content) as $line) {
            # line count and limiting
            # XXX is this needed if we're using tail()?
            if ($maxlines && $count >= $maxlines) {
                break;
            }
            ++$count;
            # we display the date range - [29/Mar/2015:06:25:15 -0700]
            preg_match("/\\[(.+?) .+?\\]/", $line, $date);
            if ($date) {
                if (!$start) {
                    $start = $date[1];
                }
                $end = $date[1];
            }
            # count errors
            preg_match("/\"GET.+?\" (\\d\\d\\d) /", $line, $matches);
            if ($matches && $matches[1] >= 400) {
                ++$errors;
                #inc($errors, $matches[1]);
            }
            # count pages only (not images and support files)
            preg_match("/GET (.+?(\\/|\\.html?|\\.pdf|\\.php)) /", $line, $matches);
            if ($matches) {
                $url = $matches[1];
                # cout the subpages
                preg_match("/{$modmatch}\\/([^\\/]+)/", $url, $sub);
                if ($sub) {
                    inc($stats, $sub[1]);
                    ++$total_pages;
                } else {
                    if (preg_match("/{$modmatch}\\/\$/", $url)) {
                        # if there was a hit with this directory as the
                        # trailing component, there was probably a page there
                        # so we count that too
                        inc($stats, "./");
                        ++$total_pages;
                    } else {
                        ++$not_counted;
                    }
                }
            } else {
                ++$not_counted;
            }
        }
        # auto-descend into directories if there's only one item
        # XXX basically we redo the above over, one dir deeper each time,
        # until we reach a break condition (multiple choices, single page, or too deep,
        # which is pretty darn inefficient
        if (sizeof($stats) == 1) {
            # PHP 5.3 compat - can't index off a function, need a temp var
            $keys = array_keys($stats);
            # but not if the one thing is an html file
            if (preg_match("/(\\/|\\.html?|\\.pdf|\\.php)\$/", $keys[0])) {
                break;
            }
//.........这里部分代码省略.........
开发者ID:rachelproject,项目名称:contentshell,代码行数:101,代码来源:stats.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP tally_config函数代码示例发布时间:2022-05-23
下一篇:
PHP tags_prepare函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap