nodejs、php命令行交互模式
一、NODE JS:代码:
test.js
test.js
var readline = require('readline');var rl = readline.createInterface({input: process.stdin,output: process.stdout});rl.question("what is your name?", function(result) {console.log(result)rl.close();});
测试:
二、PHP:代码:
test.php
<?php<?phpwhile ($result = trim(fgets(STDIN))){echo "hello:".$result.PHP_EOL;}
测试:
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。