Executing Ruby script from PHP and getting output

前端 未结 2 875
鱼传尺愫
鱼传尺愫 2021-01-15 04:51

I have this Ruby script (test.rb):

print \"hello\"

And I have this PHP script (test.php):

$cmd = \"ruby test.rb\";
system($         


        
2条回答
  •  一整个雨季
    2021-01-15 05:23

    system would capture the output of the ruby script.

    you might want to do:

    $cmd = "ruby test.rb";
    echo system($cmd);
    

提交回复
热议问题