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


PHP FileHandler::fileExists方法代码示例

本文整理汇总了PHP中FileHandler::fileExists方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::fileExists方法的具体用法?PHP FileHandler::fileExists怎么用?PHP FileHandler::fileExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHandler的用法示例。


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

示例1: printStep

/**
 * @param FileHandler $fileHandler FileHandler to use
 * @param TestInfo $testInfo Information about the test
 * @param TestStepResult $testStepResult Results of the specific test
 * @param bool $useQuicklinks True if quicklinks are used, false otherwise
 */
function printStep($fileHandler, $testInfo, $testStepResult, $useQuicklinks)
{
    $pageRunData = $testStepResult->getRawResults();
    $localPaths = $testStepResult->createTestPaths();
    $urlPaths = $testStepResult->createTestPaths(substr($testInfo->getRootDirectory(), 1));
    $urlGenerator = $testStepResult->createUrlGenerator("", FRIENDLY_URLS);
    echo "<a name=\"step_" . $testStepResult->getStepNumber() . "\">";
    echo "<h1 class='stepName'>" . $testStepResult->readableIdentifier() . "</h1>";
    echo "</a>";
    if ($fileHandler->dirExists($localPaths->videoDir())) {
        echo "<a href=\"" . $urlGenerator->createVideo() . "\">Create Video</a> &#8226; ";
        echo "<a href=\"" . $urlGenerator->downloadVideoFrames() . "\">Download Video Frames</a>";
        if ($useQuicklinks) {
            echo " &#8226; ";
        }
    }
    if ($useQuicklinks) {
        echo '<a href="#quicklinks">Back to Quicklinks</a>';
    }
    $screenShotUrl = null;
    if ($fileHandler->fileExists($localPaths->screenShotPngFile())) {
        $screenShotUrl = $urlPaths->screenShotPngFile();
    } else {
        if ($fileHandler->fileExists($localPaths->screenShotFile())) {
            $screenShotUrl = $urlPaths->screenShotFile();
        }
    }
    if ($screenShotUrl) {
        echo '<h2>Fully Loaded</h2>';
        echo '<a href="' . $screenShotUrl . '">';
        echo '<img class="center" alt="Screen Shot" style="max-width:930px; -ms-interpolation-mode: bicubic;" src="' . $screenShotUrl . '">';
        echo '</a>';
    }
    // display the last status message if we have one
    $messages = $testStepResult->getStatusMessages();
    if (count($messages)) {
        $lastMessage = end($messages);
        if (strlen($lastMessage['message'])) {
            echo "\n<br>Last Status Message: \"{$lastMessage['message']}\"\n";
        }
    }
    $stepNumber = $testStepResult->getStepNumber();
    $linkSuffix = $stepNumber > 1 ? "_" . $stepNumber : "";
    if ($fileHandler->fileExists($localPaths->additionalScreenShotFile("render"))) {
        echo '<br><br><a name="start_render' . $linkSuffix . '"><h2>Start Render';
        if (isset($pageRunData) && isset($pageRunData['render'])) {
            echo ' (' . number_format($pageRunData['render'] / 1000.0, 3) . '  sec)';
        }
        echo '</h2></a>';
        echo '<img class="center" alt="Start Render Screen Shot" src="' . $urlPaths->additionalScreenShotFile("render") . '">';
    }
    if ($fileHandler->fileExists($localPaths->additionalScreenShotFile("dom"))) {
        echo '<br><br><a name="dom_element' . $linkSuffix . '"><h2>DOM Element';
        if (isset($pageRunData) && isset($pageRunData['domTime'])) {
            echo ' (' . number_format($pageRunData['domTime'] / 1000.0, 3) . '  sec)';
        }
        echo '</h2></a>';
        echo '<img class="center" alt="DOM Element Screen Shot" src="' . $urlPaths->additionalScreenShotFile("dom") . '">';
    }
    if ($fileHandler->fileExists($localPaths->additionalScreenShotFile("doc"))) {
        echo '<br><br><a name="doc_complete' . $linkSuffix . '"><h2>Document Complete';
        if (isset($pageRunData) && isset($pageRunData['docTime'])) {
            echo ' (' . number_format($pageRunData['docTime'] / 1000.0, 3) . '  sec)';
        }
        echo '</h2></a>';
        echo '<img class="center" alt="Document Complete Screen Shot" src="' . $urlPaths->additionalScreenShotFile("doc") . '">';
    }
    if ($fileHandler->fileExists($localPaths->aftDiagnosticImageFile())) {
        echo '<br><br><a name="aft' . $linkSuffix . '"><h2>AFT Details';
        if (isset($pageRunData) && isset($pageRunData['aft'])) {
            echo ' (' . number_format($pageRunData['aft'] / 1000.0, 3) . '  sec)';
        }
        echo '</h2></a>';
        echo 'White = Stabilized Early, Blue = Dynamic, Red = Late Static (failed AFT), Green = AFT<br>';
        echo '<img class="center" alt="AFT Diagnostic image" src="' . $urlPaths->aftDiagnosticImageFile() . '">';
    }
    if ($fileHandler->fileExists($localPaths->additionalScreenShotFile("responsive"))) {
        echo '<br><br><h2 id="responsive">Responsive Site Check</h2>';
        echo '<img class="center" alt="Responsive Site Check image" src="' . $urlPaths->additionalScreenShotFile("responsive") . '">';
    }
    // display all of the status messages
    if (count($messages)) {
        echo "\n<br><br><a name=\"status_messages" . $linkSuffix . "\"><h2>Status Messages</h2></a>\n";
        echo "<table id=\"messages\" class=\"translucent\"><tr><th>Time</th><th>Message</th></tr>\n";
        foreach ($messages as $message) {
            $time = $message['time'] / 1000.0;
            if ($time > 0.0) {
                echo "<tr><td class=\"time\">{$time} sec.</td><td>{$message['message']}</td></tr>";
            }
        }
        echo "</table>\n";
    }
    $row = 0;
    $console_log = $testStepResult->getConsoleLog();
//.........这里部分代码省略.........
开发者ID:lucasRolff,项目名称:webpagetest,代码行数:101,代码来源:screen_shot.php


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