读书人

C++ 开发静态网站解决方法

发布时间: 2012-05-15 14:35:29 作者: rapoo

C++ 开发静态网站
就是用C++ 从数据库中取内容 生成静态的HTML网页的形式 有没有一些做好的代码可以参考一下啊 或者开源的平台啥的 谢谢

[解决办法]
静态网站也别用C去做啊。用C#也可以做成静态的,而且会比用C、C++简单很多。这些事情是C#的主场,不是C/C++能和它比的。

如果要简单化,其实完全可以导出数据表之后直接弄个网页编辑工具给写成网页。这样的效率应该要比你写程序快很多倍了。
[解决办法]
cgi


C/C++ code
C Language "Hello, World" program for CGIYes, really, you can write CGI programs in C or C++. Here's a real simple one to get you started. Compile it, put it in the CGI-BIN directory and off you go./*   hello.c - CGI program for the web*/#include <stdio.h>int main(){    printf("content-type: text/html\n\n");    printf("<html>\n<body>\n");    printf("<h1> Hello, World! </h1>\n");    printf("</body>\n</html>\n");    return 0;}C++ Language "Hello, World" program for CGIOK, let's be a little more modern and do it in C++.// hellop.cpp - CGI program for the web#include <iostream>using namespace std;int main(){    cout << "content-type: text/html" << endl << endl;    cout << "<html><body>" << endl;    cout << "<h1> Hello, World! </h1>" << endl;    cout << "</body></html>" << endl;    return 0;}
[解决办法]
你有数据库,网页内容根据数据库动态生成,还能是静态的么?

静态就是一堆HTML标签,都是静态预先写好的内容

要弄也可以,会c,c++其实不难,用cgi,架设一个cgi服务器,就可以了。
[解决办法]
主要使用技术是替换。。
先做个模板,标记放进去 数据库读入,替换标记即可。。

很多人回答你的是用c++来做动态网页。。,完全是答非所问。。

读书人网 >C++

热点推荐