我目前在我的大学注册了一个web应用程序课程,我们正在学习cgi脚本。我很难学习如何实现我的CGI脚本。当我点击我的链接时,会弹出一个窗口,要求我下载我的helloworld.cgi文件而不是重定向。如何使用C++ CGI脚本?
HTML:
<html>
<body>
<a href="/user/local/apache2/cgi-bin/helloworld.cgi">click me</a>
</body>
</html>
C++:
#include <iostream>
using namespace std;
int main(){
cout << "Content-type: text/html" << endl;
cout << "<html>" << endl;
cout << " <body>" << endl;
cout << " Hello World!" << endl;
cout << " </body>" << endl;
cout << "</html>" << endl;
return 0;
}
的CGI脚本存储在/user/local/apache2/cgi-bin/helloworld.cgi
只是为了确认,运行此CGI在Web服务器上,而不是关闭本地文件? – 2011-01-28 02:40:21
`/user`‽‽‽‽... – Hello71 2011-01-28 02:42:03