一、安裝DNode
1, for nodejs, 執行
執行下列語句下載composer
二、利用nodejs創建簡單server程序, server.js
// This is the class we're exposing to DNode
class Temp
{
// Compute the client's temperature and stuff that value into the callback
public function temperature($cb)
{
}
}
$loop = new React/EventLoop/StreamSelectLoop();
$dnode = new DNode/DNode($loop, new Temp());
$dnode->connect(7070, function($remote, $connection) {
// Remote is a proxy object that provides us all methods
// from the server
$remote->zing(33, function($n) use ($connection) {
echo "n = {$n}/n";
// Once we have the result we can close the connection
$connection->end();
});
});
$loop->run();
?>
新聞熱點
疑難解答
圖片精選