zoukankan      html  css  js  c++  java
  • Hello World! 这是我的第一个 CGI 程序

    Hello World! 这是我的第一个 CGI 程序
    上面的 C++ 程序是一个简单的程序,把它的输出写在 STDOUT 文件上,即显示在屏幕上。在这里,值得注意一点,第一行输出 Content-type:text/html 。这一行发送回浏览器,并指定要显示在浏览器窗口上的内容类型。您必须理解 CGI 的基本概念,这样才能进一步使用 Python 编写更多复杂的 CGI 程序。C++ CGI 程序可以与任何其他外部的系统(如 RDBMS)进行交互。

     1 #include <iostream>
     2 using namespace std;
     3  
     4 int main ()
     5 {
     6     
     7    cout << "Content-type:text/html
    
    ";
     8    cout << "<html>
    ";
     9    cout << "<head>
    ";
    10    cout << "<title>Hello World - 第一个 CGI 程序</title>
    ";
    11    cout << "</head>
    ";
    12    cout << "<body>
    ";
    13    cout << "<h2>Hello World! 这是我的第一个 CGI 程序</h2>
    ";
    14    cout << "</body>
    ";
    15    cout << "</html>
    ";
    16    
    17    return 0;
    18 }
  • 相关阅读:
    Split Temporary Variable
    Introduce Explaining Variable
    Replace Temp with Query
    Extract Method
    自测代码的价值
    代码的坏味道
    Divergent Change & Shotgun Surgery
    Large Class
    Long Method
    Duplicated Code
  • 原文地址:https://www.cnblogs.com/borter/p/9401344.html
Copyright © 2011-2022 走看看