问题同标题,请高手解释一下CGI是什么,为什么有CGI的代码和无CGI的代码不一样啊?

解决方案 »

  1.   

    cgi是common gateway interface(公共网关接口)的缩写.
      

  2.   

    您可以写一个很简单的脚本来检验一下
    <HTML>
    <head><title>test</title></head>
    <body>
    <form name="wulala" method="POST" action="/cgi-bin/mycgi">
    <input type="password" name="user_password" maxlength="10">
    <input type="submit" name="okbutton" value="ok">
    </form>
    </body>
    </html>
    输入fdsafdsa
    这样当您点ok时,会产生这样的字符串
    http://xxxx/cgi-bin/mycgi?user_password=fdsafdsa&okbutton=ok然后编写mycgi
    {
    char t[ 1000 ];
    scanf( "%s", t );
    printf( "\n\n" );
    printf( "<h1>%s</h1>", t );
    }
    在网页上将打印出user_password=fdsafdsa&okbutton=ok
      

  3.   

    最开始的交互式的网站就是这么做的,他们拆分字符串信息
    aaaaaaaaaa=bbbbbbbbbbbbbb
    cccccc=fdsa
    oooo=然后根据内容不同动态产生相应的操作,供人浏览,现在这些东西被更加强大的和先进的方法取代了。
      

  4.   

    那请问发送给CGI的请求数据在VC中应该用什么函数实现?
    或是怎么样来实现?
    就是用VC的函数给mycgi发送一个这样的信息:
    user_password=999&okbutton=ok;
    谢谢高手帮忙.