L'Utilisation De C++ Script CGI?

Je suis actuellement inscrit dans un site web d'applications de classe à mon collège et nous en apprendre davantage sur les scripts cgi. Je vais avoir du mal à apprendre à exécuter mon script CGI. Lorsque je clique sur mon lien, une fenêtre apparaît me demandant de télécharger mon helloworld.cgi fichier plutôt que de simplement la redirection.

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;
    }

Le script CGI est stocké à /user/local/apache2/cgi-bin/helloworld.cgi

  • Juste pour confirmer, vous exécutez ce CGI sur un serveur web, et non pas le fichier local?
  • /user‽‽‽‽ ...
InformationsquelleAutor Johnrad | 2011-01-28