开发者

apache and cgicc - differentiate between post and get variables

开发者 https://www.devze.com 2023-04-06 01:08 出处:网络
In PHP it is very simple to check, if a variable has been transmitted via GET or POST. With the cgicc library they all look the same. Is there another possibility to read only GET or only POST 开发者_

In PHP it is very simple to check, if a variable has been transmitted via GET or POST. With the cgicc library they all look the same. Is there another possibility to read only GET or only POST 开发者_Python百科variables?

My Code:

cgicc:Cgicc cgiobj;
std::cout << "Both, post or get: " << cgiobj("variablename") << std::endl;


I had the same question so I looked for a solution in the cgicc documentation. Class CgiEnvironment provides getRequestMethod() which returns "GET" or "POST" accordingly to your request.

eg.

cgicc::Cgicc cgi;
cgicc::CgiEnvironment env = cgi.getEnvironment();
std::string requestMethod = env.getRequestMethod();

I have not tested it, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消