编写CGI脚本:
最基本的Ruby CGI脚本看起来像这样:
#!/usr/bin/ruby
puts HTTP/1.0 200 OK
puts Content-type: text/html\n\n
puts This is a test
如果调用这个脚本 test.cgi 上传到基于Unix/Linux的Web托管服务提供商并具有合适的权限,那么可以将它作为一个CGI脚本使用。
例如,如果有一个Linux的Web托管服务提供商托管的网站,如:http://www.yiibai.com/t
1.首先明确,只能够指定某个确定的目录,支持cgi,即运行该目录执行cgi程序;否则不太安全。寻找: 代码如下: # # “C:/Program Files/Apache Group/Apache/cgi-bin” should be changed to whatever your scr iptAliased # CGI directory exists, if you have that configured. # AllowOverride