rails demo #create app called demo ruby demo/script/server #start server #browser http://127.1:3000 to view you first app #创建一个 say 的控制器 ruby demo/script/generate controller Say #在demo/app/controllers/ 生成一个 say_controller.rb #内容如下: class SayController < ApplicationController #添加一个叫hello的方法 def hello @time = Time.now end end #再到demo/app/views/cai/ 文件夹下面 建立一个 hello.html.erb 文件 #body 内容如下 <body> 现在时间: <%=@time %> </body> #在浏览器中输入 http://localhost:3000/say/hello #就可以得到但前的时间。