fastcgi++应用初探
来源:互联网 发布:北京凶宅数据库名单 编辑:程序博客网 时间:2024/06/04 19:51
fastcgi++作为一个完全C++编写的fastcgi应用开发包,封装了很多功能,比如参数提取,session,mysql数据库连接管理等最大限度的简化cgi编程。
编写一个简单的helloworld的fastcgi应用。
- #include <fstream>
- #include <boost/date_time/posix_time/posix_time.hpp>
- #include <fastcgi++/request.hpp>
- #include <fastcgi++/manager.hpp>
- void error_log(constchar* msg)
- {
- using namespace std;
- using namespace boost;
- static ofstream error;
- if(!error.is_open())
- {
- error.open("/tmp/errlog", ios_base::out | ios_base::app);
- error.imbue(locale(error.getloc(), new posix_time::time_facet()));
- }
- error << '[' << posix_time::second_clock::local_time() <<"] " << msg << endl;
- }
- class Helloworld: public Fastcgipp::Request<char>{
- public:
- bool response()
- {
- out << "<html><body>";
- out << "Hello world!";
- out << "</body></html>";
- return true;
- }
- }
- main(){
- try
- {
- Fastcgipp::Manager<Helloworld> fcgi;
- fcgi.handler();
- }
- catch(std::exception& e)
- {
- error_log(e.what());
- }
- }
可以看到基本的只要从 Fastcgipp::Request派生一个类,实现其中的 bool response() 函数就可以完成一个fastcgi 应用。
0 0
- fastcgi++应用初探
- FastCgi原理初探
- 在云端Host FastCGI 应用
- 使用fastcgi部署django应用
- FastCGI
- FastCGI
- fastcgi
- fastcgi
- fastcgi
- fastcgi
- fastcgi
- FastCGI
- FastCGI
- FastCGI
- FastCGI
- FastCGI
- FastCGI
- FastCGI
- F. Ant colony(Codeforces Round #271)
- Python-OpenCV教程-4
- SVN中文版客户端下载安装及配置
- linux的hostname修改详解
- Linux设置虚拟内存
- fastcgi++应用初探
- 输入一个错位后敲出的字符串,输出打字员本想打出的字符
- 学习中遇到的难题
- JS 事件集合
- 指定某时间段执行某个需求
- eclipse 操作技巧
- Spring MVC Controller 单元测试
- 《数据结构》第一章思维导图
- 用Ant实现Java项目的自动构建和部署