本文整理汇总了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);
示例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";