1
我想從C++數據保存到PHP和這裏是我爲什麼我不能從C++向PHP發送多個參數?
string cmd = "wget localhost/tem1.php?t=1&date=1&time=1";
system((const char*) cmd.c_str());
,你可以看到我想給參數t,日期和時間,但它只是先將T無兩個其他參數,這裏是輸出:
--2016-11-21 20:56:45-- http://localhost/tem1.php?t=1
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5 [text/html]
Saving to: 'tem1.php?t=1'
爲什麼只需要t?請幫我解決這個問題 *注: 當我把它寫在鏈接欄,將插入數據成功 謝謝
'to_string(temperature)'的結果是什麼?會不會有特殊的角色? 'date'和'time'是一個有效的字符串嗎? – Jeff
您是否嘗試輸出'cmd'來查看它是什麼? – AbraCadaver
@Jeff溫度是一個浮點數,但我將它轉換爲字符串纔有效,當我打印cmd時,它給了我這個'tem1.php?t = 4&date = 3&time = 1',並忽略了其他參數(日期和時間) –