當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Console::put方法代碼示例

本文整理匯總了PHP中Console::put方法的典型用法代碼示例。如果您正苦於以下問題:PHP Console::put方法的具體用法?PHP Console::put怎麽用?PHP Console::put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Console的用法示例。


在下文中一共展示了Console::put方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: swoole_client

            } else {
                Console::put("Echo Service on TCP");
            }
        }
    }
    //上麵已經測試過通道,所下麵就不再重複檢測
    $client->send("task");
    $data = $client->recv();
    Console::put("swoole_server->task()", !$data or $data != 'taskok');
    $client->send("taskwait");
    $data = $client->recv();
    Console::put("swoole_server->taskwait()", !$data or $data != 'taskwaitok');
}
Console::put("swoole_client->close()", !$client->close());
echo "------------------------------------------------------------------\n";
$client = new swoole_client(SWOOLE_UDP);
Console::put("swoole_client[UDP]->recv()", !$client->connect('127.0.0.1', 9502));
Console::put("swoole_client[UDP]->recv()", !$client->send("hello"));
$data = $client->recv();
if (!$data) {
    Console::put("swoole_client[UDP]->recv()", true);
} else {
    if ($data != "Swoole: hello") {
        Console::put("Echo Service on UDP", true);
    } else {
        Console::put("Echo Service on UDP");
    }
}
echo "------------------------------------------------------------------\n";
Console::put("test failed", true);
開發者ID:zzjin,項目名稱:swoole-src,代碼行數:30,代碼來源:unittest.php

示例2: test_taskWaitMulti

    Console::put("swoole_server->taskwait()", $data and $data == 'taskwaitok');
    Console::put("swoole_server->taskWaitMulti()", test_taskWaitMulti($client));
}
$client->send("close");
$data = $client->recv();
Console::put("swoole_server->close()", $data == '');
echo "------------------------------------------------------------------\n";
Console::put("swoole_client[TCP]->recv()", true);
Console::put("swoole_client[TCP]->recv(256K, MSG_WAITALL)", $sendBigPkgTest);
$sockname = $client->getsockname();
Console::put("swoole_client[TCP]->getsockname()", is_array($sockname));
echo "------------------------------------------------------------------\n";
Console::put("swoole_client[TCP]->close()", $client->close());
echo "------------------------------------------------------------------\n";
$client = new swoole_client(SWOOLE_UDP);
Console::put("swoole_client[UDP]->connect()", $client->connect('127.0.0.1', 9502));
Console::put("swoole_client[UDP]->send()", $client->send("hello"));
$data = $client->recv();
Console::put("swoole_client[UDP]->recv()", $data and $data == 'Swoole: hello');
$peername = $client->getpeername();
Console::put("swoole_client[UDP]->getpeername()", is_array($peername) and $peername['port'] == 9502);
echo "------------------------------------------------------------------\n";
/**
 * Server測試結束,關閉服務器
 */
swoole_process::kill($server->pid + 1, SIGTERM);
Console::put("swoole_process::kill()");
$status = swoole_process::wait();
Console::put("swoole_process::wait()", $status['pid'] == $server->pid);
echo "------------------------------------------------------------------\n";
echo "Swoole UnitTest Finish.\n";
開發者ID:swoole,項目名稱:tests,代碼行數:31,代碼來源:run-tests.php


注:本文中的Console::put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。