【发布时间】:2011-12-22 21:38:42
【问题描述】:
我有这个 Ruby 脚本 (test.rb):
print "hello"
我有这个 PHP 脚本 (test.php):
$cmd = "ruby test.rb";
system($cmd);
现在我以这种方式从 CLI 调用我的 PHP 脚本:
php test.php
我没有得到任何输出(它应该打印“hello”)
为什么?
【问题讨论】:
-
您的 PHP 文件中是否漏掉了分号?
-
我不了解 PHP,但您可能想要
puts "Hello"。print不包含换行符。