Login
Воспоминания Си Джи Ай 15.02.2025
635 просмотров
Перейти к просмотру всей ветки
in Antwort uscheswoi_82 18.02.25 09:07
Подправлю. Вместо void Request::setContentType(string strContentType) надо писать void Request::setContentType(string strContentType). Это только в C# и VB NET принято писать так void Request::setContentType(string strContentType). А в Си++, PHP, и Java пишут так set_...() или get_...() и всё маленькими буквами!
Request.hpp:
#ifndef _REQUEST
#define _REQUEST
#include <iostream>
#include <string>
using namespace std;
class Request {
private:
string strContentType;
public:
Request();
void set_content_type(string strContentType);
string get_method();
string get_query();
string get_uri();
string get_cookies();
};
#endifRequest.cpp:
#include "request.hpp"
void Request::set_content_type(string strContentType) {
this->strContentType = strContentType;
cout << "Content-Type:" << strContentType << "\n\r" << endl;
}
string Request::get_method() {
return getenv("REQUEST_METHOD");
}
string Request::get_query() {
return getenv("QUERY_STRING");
}
string Request::get_uri() {
return getenv("REQUEST_URI");
}
string Request::get_cookies() {
return getenv("HTTP_COOKIE");
}Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнении
Meine Die Formel der Liebe
Meine Die Formel der Liebe