我已经对代码进行了更改
i have made changes to the code
本文关键字:代码 更新时间:2023-10-16
这是我的方法,不起作用。
void ApplicationUI::Post(const QString &id,const QString &name,const QString &surname,const QString &grade, const QString &dob,const QString &language,const QString &school, const QString &gender,const QString &cellno,const QString ®istrationDate)
{
this->connection = new QNetworkAccessManager(this);
connect(this->connection, SIGNAL(finished(QNetworkReply*)), this, SLOT(postFinished()));
QUrl url("http://172.27.15.7/BB10_Scripts/Registration.php");
QUrl postParams;
postParams.addQueryItem("id",id);
postParams.addQueryItem("name", name);
postParams.addQueryItem("surname",surname);
postParams.addQueryItem("grade",grade);
postParams.addQueryItem("dob",dob);
postParams.addQueryItem("language",language);
postParams.addQueryItem("school",school);
postParams.addQueryItem("gender",gender);
postParams.addQueryItem("cellno",cellno);
postParams.addQueryItem("registrationDate",registrationDate);
QByteArray data;
data.append(postParams.data);
data.remove(0,1);
QNetworkRequest req;
req.setUrl(url);
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
this->connection->post(req,postParams.encodedQuery());());
bool ok = QObject::connect(connection, SIGNAL(finished(QNetworkReply*)), this, SLOT(postFinished()));
Q_ASSERT(ok);
Q_UNUSED(ok);
qDebug() << "Connection is success : ? : " << ok;
}
我收到的消息
连接成功:?:真的进程476930267(级联项目)终止SIGSEGV代码=1 fltno=11>ip=79f70ce2>(/base/usr/lib/qt4/lib/libQtNetwork.so.4.8.5@_ZNK13QNetworkReply5errorEv+0x9)>映射地址=00060ce2。ref=0000000 4 bdslot=1
postParams.addQueryItem("id", id);
postParams.addQueryItem("name", name);
postParams.addQueryItem("surname", surname);
postParams.addQueryItem("grade", grade);
postParams.addQueryItem("dob", dob);
postParams.addQueryItem("language", language);
postParams.addQueryItem("school", school);
postParams.addQueryItem("gender", gender);
postParams.addQueryItem("cellno", cellno);
postParams.addQueryItem("registrationDate",registrationDate);
QNetworkRequest request;
request.setUrl(QUrl("http://172.27.15.7/BB10_Scripts/Registration.php?"));
bool res;
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
Q_UNUSED(res);
this->reply = connection->post(request, postParams.encodedQuery());
res = QObject::connect(this->reply, SIGNAL(finished()),this, SLOT(postFinished()));
Q_ASSERT(res);
Q_UNUSED(res);
qDebug() << "Connection is success : ? : " << res;
相关文章:
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 代码在main()中运行,但在函数中出现错误
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 编译包含字符串的代码时遇到问题
- 我在c++代码中生成了一个运行时#3异常
- 如何在linux终端中同时编译和运行c++代码
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 在Linux for Windows上编译C++代码时出错
- 我的字符计数代码计算错误.为什么
- 孤立代码块在结构中引发异常
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- 此代码是否违反一个定义规则
- 为什么我的代码在输出中增加了93天
- 我的简单if-else语句是如何无法访问的代码
- 使用动态分配的数组会导致代码分析发出虚假的C6386缓冲区溢出警告
- 为什么在这个代码结束循环中没有得到结束
- 在c代码之间共享数据的最佳方式
- 这个指针和内存代码打印是什么?我不知道是打印垃圾还是如何打印我需要的值