我想使用此代码将数据发布到 PHP 表单,但编译后我有消息:
Object::connect: 没有这样的信号 NetworkReplyImpl::finished(QNetworkReply*):
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QUrl params;
QUrl url("localhost/test2.php");
params.addQueryItem("name","aaa");
params.addQueryItem("country","bbb");
QByteArray data;
data.append(params.toString());
data.remove(0,1);
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkReply *reply = manager->post(QNetworkRequest(url), data);
connect(reply, SIGNAL(finished(QNetworkReply*)), this,SLOT(replyFinished(QNetworkReply*)));
}
MainWindow::~MainWindow()
{
}
void MainWindow::replyFinished(QNetworkReply *reply)
{
QString data = reply->readAll().trimmed();
qDebug() << data;
}