ruby程序要怎么才能在http:localhost:3000页面上浏览出来?

Python08

ruby程序要怎么才能在http:localhost:3000页面上浏览出来?,第1张

puts "hello 是写在rb文件中的

eg

app/controllers/hello_controller.rb #画面的控制

class HelloController <ActionController

def index

@hello = "hello"

puts @hello # "hello"

end

end

app/views/hello/index.rhtml

<table border="1">

<tr>

<td><%=@hello%></td> #@hello 或者$hello 这种变量才能在页面中使用

</tr>

</table>

地址是:http://localhost:3000/hello/say

1.获取操作系统的信息2.获取浏览器的信息Ruby代码:WIN32OLE.connect('winmgmts:\\\\.\\root\\cimv2\\Applications\\MicrosoftIE').ExecQuery("SELECT * FROM MicrosoftIE_Summary" ).each do |m|p "#{m.Name} #{m.Version}"endWIN32OLE.connect('winmgmts:\\\\.\\root\\cimv2\\Applications\\MicrosoftIE').ExecQuery("SELECT * FROM MicrosoftIE_Summary" ).each do |m|

在cmd里也是调用ruby的解析器。不太确定你想要什么效果,如果只是不想每次都在cmd里敲命令的话,可以把*.rb文件的打开方式关联到ruby.exe,这样只要双击*.rb文件就可以执行了。