我目前在我的大學註冊了一個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