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


PHP printResult函数代码示例

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


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

示例1: main

function main()
{
    global $ACCESS_TOKEN, $USER_AGENT;
    // Set the API sport, method, id, format, and any parameters
    $host = 'erikberg.com';
    $sport = '';
    $method = 'events';
    $id = '';
    $format = 'json';
    $parameters = array('sport' => 'nba', 'date' => '20130414');
    // Pass method, format, and parameters to build request url
    $url = buildURL($host, $sport, $method, $id, $format, $parameters);
    // Set the User Agent, Authorization header and allow gzip
    $default_opts = array('http' => array('user_agent' => $USER_AGENT, 'header' => array('Accept-Encoding: gzip', 'Authorization: Bearer ' . $ACCESS_TOKEN)));
    stream_context_get_default($default_opts);
    $file = 'compress.zlib://' . $url;
    $fh = fopen($file, 'rb');
    if ($fh && strpos($http_response_header[0], "200 OK") !== false) {
        $content = stream_get_contents($fh);
        fclose($fh);
        printResult($content);
    } else {
        // handle error, check $http_response_header for HTTP status code, etc.
        if ($fh) {
            $xmlstats_error = json_decode(stream_get_contents($fh));
            printf("Server returned %s error along with this message:\n%s\n", $xmlstats_error->error->code, $xmlstats_error->error->description);
        } else {
            print "A problem was encountered trying to connect to the server!\n";
            print_r(error_get_last());
        }
    }
}
开发者ID:jrgomez76,项目名称:nba-app,代码行数:32,代码来源:listing.php

示例2: printTop10TeamsGamesPlayed

function printTop10TeamsGamesPlayed($orderBy, $showTop)
{
    $conn = connectToDatabase();
    $query = "SELECT Name, Leader, Game_Count, Win_Count, 100*Win_Count/Team.Game_Count FROM TEAM ORDER BY Game_Count " . $orderBy . " LIMIT " . $showTop;
    $result = $conn->query($query);
    printResult($result);
    $conn->close();
}
开发者ID:robert-vo,项目名称:Bowling-Score-Tracking-System,代码行数:8,代码来源:getReport.php

示例3: printCookbook

function printCookbook($cookbook_id)
{
    $conn = getConn();
    $sql = " SELECT cb_title FROM cookbook\n\t\t\t\tWHERE cookbook_id = '{$cookbook_id}'";
    $result = $conn->query($sql);
    $row = $result->fetch_assoc();
    echo '<h1>' . $row["cb_title"] . '</h1>';
    $sql = " SELECT  * FROM recipe\n\t\t\t\tWHERE recipe_id in (\n\t\t\t\t\tSELECT recipe_id FROM recipe_list\n\t\t\t\t\tWHERE cookbook_id = '{$cookbook_id}')";
    $result = $conn->query($sql);
    printResult($result);
}
开发者ID:eoyarzun,项目名称:CookbookNetwork,代码行数:11,代码来源:view-cookbook.php

示例4: test

function test()
{
    if (isset($_GET) && isset($_GET["keywords"]) && isset($_GET["target"])) {
        $db = connect();
        $json = search($_GET["keywords"], $_GET["target"], $db);
        $arr = json_decode($json, true);
        if (isset($arr["movie"])) {
            $m = $arr["movie"];
            echo "<h3>Movies</h3>";
            $me = $m["exact"];
            echo "<b>Exact Results:</b><br />";
            printResult($me);
            $mc = $m["close"];
            echo "<b>Close Results:</b><br />";
            printResult($mc);
            $mp = $m["partial"];
            echo "<b>Partial Results:</b><br />";
            printResult($mp);
        }
        if (isset($arr["actor"])) {
            $a = $arr["actor"];
            echo "<h3>Actors</h3>";
            $ae = $a["exact"];
            echo "<b>Exact Results:</b><br />";
            printResult($ae);
            $ap = $a["partial"];
            echo "<b>Partial Results:</b><br />";
            printResult($ap);
        }
        if (isset($arr["director"])) {
            $d = $arr["director"];
            echo "<h3>Directors</h3>";
            $de = $d["exact"];
            echo "<b>Exact Results:</b><br />";
            printResult($de);
            $dp = $d["partial"];
            echo "<b>Partial Results:</b><br />";
            printResult($dp);
        }
        disconnect($db);
    }
}
开发者ID:jenniferwjo,项目名称:CS-143,代码行数:42,代码来源:searchtest.php

示例5: cbTagBrowse

function cbTagBrowse()
{
    $conn = getConn();
    $tags = $_POST["tags"];
    $len = count($tags);
    if ($len <= 1) {
        $tag = $tags[0];
        $sql = " SELECT * FROM cookbook\n\t\t\t\t\tWHERE cookbook_id in (\n\t\t\t\t\t\tSELECT type_id FROM tag\n\t\t\t\t\t\tWHERE name = '{$tag}' AND type = 'COOKBOOK')";
    } else {
        $first = $tags[0];
        $sql = " SELECT type_id FROM tag\n\t\t\t\t\tWHERE name = '{$first}' AND type = 'COOKBOOK' ";
        for ($i = 1; $i < $len; $i++) {
            $current = $tags[$i];
            $sql = " SELECT type_id FROM tag\n\t\t\t\t\t\tWHERE name = '{$current}' \n\t\t\t\t\t\t\tAND type = 'COOKBOOK'\n\t\t\t\t\t\t\tAND type_id in (" . $sql . ")";
        }
        $sql = " SELECT * FROM cookbook\n\t\t\t\t\tWHERE cookbook_id in (" . $sql . ")";
    }
    printResult($conn->query($sql));
    $conn->close();
}
开发者ID:eoyarzun,项目名称:CookbookNetwork,代码行数:20,代码来源:cookbook-search-handler.php

示例6: printResult

if (isset($_POST['checkTime']) && $_POST['checkTime'] > time() - 60 * 5) {
    // Initiate the MetaTune object.
    $spotiy = MetaTune::getInstance();
    $out = '<div class="masterResult">';
    if (!empty($_POST['artist'])) {
        // Get a list of artists
        $response = $spotiy->searchArtist($_POST['artist']);
        $out .= "<div class=\"resultBox\"><h2>Artists</h2>";
        $out .= printResult($response);
        $out .= "</div>";
    }
    if (!empty($_POST['album'])) {
        // Get a list of albums from search
        $response = $spotiy->searchAlbum($_POST['album']);
        $out .= "<div class=\"resultBox\"><h2>Albums</h2>";
        $out .= printResult($response);
        $out .= "</div>";
    }
    if (!empty($_POST['track'])) {
        // Search and get a list of tracks/song.
        $response = $spotiy->searchTrack($_POST['track']);
        $out .= "\t<div class=\"last\">\n\t<h2>Tracks</h2>\n";
        $out .= songResult($response);
        $out .= "\t</div>\n";
    }
    $out .= "</div>\n";
    echo $out;
}
if (DEBUG) {
    $end = microtime();
    echo "<pre>Debug time: " . ($end - $start) . "</pre>";
开发者ID:residencygroup,项目名称:metatune,代码行数:31,代码来源:index.php

示例7: connectDB

<?php

connectDB("{$gasDatabaseName}");
if ($action == 'GetPosition') {
    // 寻找还没有被接单的订单, 且已经支付的订单
    $sql = "select * from GasOrder,Customer where GasOrder.Uid = Customer.Uid and OrderDelivery = 0 and OrderStatus = 1 and OrderComplete = 0";
    printResult($sql);
} else {
    if ($action == "ReceiveOrder") {
        // gasman接订单
        $orderId = post("OrderId");
        $orderDistance = post("OrderDistance");
        $uid = session("Uid");
        $sql = "update GasOrder set OrderDelivery = 1, GasmanId = {$uid}, OrderDistance = '{$orderDistance}' where OrderId = {$orderId}";
        query("{$sql}");
        printResultByMessage("", 0);
    }
}
开发者ID:qichangjun,项目名称:HTMLLearn,代码行数:18,代码来源:mapAction.php

示例8: findDigits

<?php

$digits = findDigits(1234);
printResult($digits);
$digits = findDigits(145);
printResult($digits);
$digits = findDigits(15);
printResult($digits);
$digits = findDigits(247);
printResult($digits);
function printResult($digits)
{
    if (count($digits) > 0) {
        echo implode(', ', $digits);
    } else {
        echo "no";
    }
    echo "<hr>";
}
function findDigits($n)
{
    $array = [];
    if ($n < 100) {
        return $array;
    }
    for ($i = 1; $i <= 9; $i++) {
        for ($j = 0; $j <= 9; $j++) {
            for ($k = 0; $k <= 9; $k++) {
                if ($i != $j && $j != $k && $k != $i) {
                    $result = "{$i}{$j}{$k}";
                    if ((int) $result <= $n) {
开发者ID:nok32,项目名称:SoftUny-HW,代码行数:31,代码来源:NonRepeatingDigits.php

示例9: mysqli

$mysql = new mysqli("localhost", "root", "vodoley14", "users");
// if (!$mysql) {
// 	echo "dont work";
// } else {
// 	echo "work";
// }
$mysql->query("SET NAMES 'utf8");
$result_set = $mysql->query("SELECT * FROM `users_table`");
if (isset($_POST['add'])) {
    // print_r($_POST);
    $name = $_POST['name'];
    $html = htmlspecialchars($_POST['html']);
    $mysql->query("INSERT INTO `users_table` (`name`,`date`,`html`,`update`) VALUES ('" . $name . "','" . time() . "','" . $html . "','" . time() . "')");
    header('Location: index.php');
}
printResult($result_set);
$mysql->close();
date_default_timezone_set("Europa/Lviv");
echo "The time is " . date("h:i:sa");
?>
 <!DOCTYPE html>
 <html lang="en">
 <head>
 	<style>
 	table {
    border-collapse: collapse;
}
		td {
			border: 1px solid black;
		}
		#delete {
开发者ID:KapralOleh,项目名称:CRUD-mysqli,代码行数:31,代码来源:index.php

示例10: getLeads

function getLeads($reindeers)
{
    $max = 0;
    $leads = [];
    foreach ($reindeers as $name => $r) {
        if ($r['distance'] > $max) {
            $max = $r['distance'];
            $leads = [$name];
        } elseif ($r['distance'] == $max) {
            $leads[] = $name;
        }
    }
    return $leads;
}
function printResult($reindeers)
{
    $maxDist = 0;
    $maxPoints = 0;
    foreach ($reindeers as $name => $r) {
        printf("%s\t%d m\t%d points\n", $name, $r['distance'], $r['points']);
        $maxDist = $r['distance'] > $maxDist ? $r['distance'] : $maxDist;
        $maxPoints = $r['points'] > $maxPoints ? $r['points'] : $maxPoints;
    }
    print "Max distance:\t{$maxDist}\n";
    print "Max points:\t{$maxPoints}\n";
}
for ($i = 0; $i < $seconds; $i++) {
    increment($reindeers);
}
printResult($reindeers);
开发者ID:MaMa,项目名称:adventofcode,代码行数:30,代码来源:day14.php

示例11: printTable

function printTable($table)
{
    $result = executePlainSQL("select * from {$table}");
    echo "<br>Got data from table {$table}:<br>";
    printResult($result);
}
开发者ID:dchanman,项目名称:tinder-plus-plus,代码行数:6,代码来源:sql-cmds.php

示例12: microtime

            $timeTaken[$regnum][$itter][$strnum] = (microtime(true) - $iterStarTime) * 1000;
            // count how many times we test against the large string on this regex
            if ($strnum == 5) {
                $testedAgainstLargeString++;
            }
            if (debug && $itter % 1000 == 0) {
                echo $b;
            }
            if (debug && $itter % 1000 == 0) {
                echo " took " . $timeTaken[$regnum][$itter][$strnum] . "ms" . "\n";
            }
        }
    }
}
$endTime = microtime(true);
printResult("QUERUCS", $timeTaken, ($endTime - $startTime) * 1000, $matches);
function printResult($regexName, &$matrix, $totalTime, $matches)
{
    global $re, $str;
    // timeTaken[regnum,itter,strnum]
    if (html) {
        echo "<table>";
        echo "<tr><th colspan=\"3\"><h2>Regular expression library:</h2></th><td colspan=\"3\"><h2>" . $regexName . "</h2></td></tr>";
    } else {
        echo "------------------------------------------";
        echo "Regular expression library: " . $regexName . "\n";
    }
    for ($ire = 0; $ire < count($re); $ire++) {
        if (html) {
            echo "<tr><th>RE:</th><td colspan=\"5\">" . $re[$ire] . "</td></tr>";
            echo "<tr><th>MS</th><th>MAX</th><th>AVG</th><th>MIN</th><th>DEV</th><th>INPUT</th><th>MATCH</th></tr>";
开发者ID:dw4dev,项目名称:Phalanger,代码行数:31,代码来源:index.php

示例13: array

$log->LogInfo("===========处理后台请求开始============");
$params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '03', 'txnSubType' => '00', 'bizType' => '000201', 'accessType' => '0', 'channelType' => '07', 'backUrl' => SDK_BACK_NOTIFY_URL, 'orderId' => $_POST["orderId"], 'merId' => $_POST["merId"], 'origQryId' => $_POST["origQryId"], 'txnTime' => $_POST["txnTime"], 'txnAmt' => $_POST["txnAmt"]);
sign($params);
// 签名
$url = SDK_BACK_TRANS_URL;
$log->LogInfo("后台请求地址为>" . $url);
$result = post($params, $url, $errMsg);
if (!$result) {
    //没收到200应答的情况
    printResult($url, $params, "");
    echo "POST请求失败:" . $errMsg;
    return;
}
$log->LogInfo("后台返回结果为>" . $result);
$result_arr = convertStringToArray($result);
printResult($url, $params, $result);
//页面打印请求应答数据
if (!verify($result_arr)) {
    echo "应答报文验签失败<br>\n";
    return;
}
echo "应答报文验签成功<br>\n";
if ($result_arr["respCode"] == "00") {
    //交易已受理,等待接收后台通知更新订单状态,如果通知长时间未收到也可发起交易状态查询
    //TODO
    echo "受理成功。<br>\n";
} else {
    if ($result_arr["respCode"] == "03" || $result_arr["respCode"] == "04" || $result_arr["respCode"] == "05") {
        //后续需发起交易状态查询交易确定交易状态
        //TODO
        echo "处理超时,请稍微查询。<br>\n";
开发者ID:alucard263096,项目名称:AMK,代码行数:31,代码来源:Form_6_7_3_PreauthFinish.php

示例14: printResult

                if ($a->result === $b->result) {
                    $result = $a->id - $b->id;
                } else {
                    $result = $a->result - $b->result;
                }
            } else {
                if ($a->result === $b->result) {
                    $result = $b->id - $a->id;
                } else {
                    $result = $b->result - $a->result;
                }
            }
            break;
    }
    return $result;
});
echo printResult($students);
function printResult($data)
{
    $result = "<thead><tr><th>Id</th><th>Username</th><th>Email</th><th>Type</th><th>Result</th></tr></thead>";
    for ($row = 0; $row < count($data); $row++) {
        $result .= "<tr>";
        $result .= "<td>" . htmlspecialchars($data[$row]->id) . "</td>";
        $result .= "<td>" . htmlspecialchars($data[$row]->name) . "</td>";
        $result .= "<td>" . htmlspecialchars($data[$row]->email) . "</td>";
        $result .= "<td>" . htmlspecialchars($data[$row]->type) . "</td>";
        $result .= "<td>" . htmlspecialchars($data[$row]->result) . "</td>";
        $result .= "</tr>";
    }
    return "<table>{$result}</table>";
}
开发者ID:AmaranthInHell,项目名称:SoftUni,代码行数:31,代码来源:SoftUniStudents.php

示例15: photographer

    print "<br/> width: " . $drPublishApiClientImage->getWidth();
    print "<br/> height: " . $drPublishApiClientImage->getHeight();
    print "<br/><br/> photographer (advanced, DrPublishApiClientImage::getDPPhotographer() ";
    print "<pre>";
    print printResult($drPublishApiClientImage->getDPPhotographer());
    print "</pre>";
    print "<hr/>";
}
?>
    <h4>Thumbnails [DrPublishApiWebClientArticleElement
    DrPublishApiWebClientImageElement::getThumbnail(size)]</h4>
        <pre>
<?php 
foreach ($drPublishApiClientImages as $drPublishApiClientImageElement) {
    $drPublishApiClientImage = $drPublishApiClientImageElement->getResizedImage(75);
    print printResult($drPublishApiClientImage);
    print $drPublishApiClientImage;
    print " width=" . $drPublishApiClientImage->getWidth();
    print " src=" . $drPublishApiClientImage->getUrl();
}
?>
        </div>
    </pre>
</div>

<h3>Fact Boxes [DrPublishApiClientList DrPublishApiWebClient::getFactBoxes()]</h3>
<div class="result">
    <div class="content-container"><?php 
print $drPublishApiClientArticle->getFactBoxes();
?>
</div>
开发者ID:rudolfrck,项目名称:no.aptoma.drpublish.api.client.php,代码行数:31,代码来源:article.inc.php


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