【发布时间】:2017-02-08 21:08:27
【问题描述】:
http 请求代码
POST /parse.php HTTP/1.1
Host: mysite.com
Connection: Keep-Alive
Content-Length: 26
Content-Type: application/x-www-urlencoded
lt=12.123123&ln=123.123123
php 代码
//connect to database codes here
$database = "update name_tbl set lat='".$_GET['lt']."', lng='".$_GET['ln']."' where id=1";
mysqli_query($conn, $database)
所以当我输入 mysite.com/parse.php?lt=12.123123&ln=123.123123 以测试它是否正常工作时,我认为我的问题在于 php 部分,但是当我在 HttpRequest 上的 http 请求代码时 但发送值都是 0.000000。
【问题讨论】:
-
如果您发出一个帖子请求,您的变量将在
$_POST,而不是$_GET。另外,如果用户将lt设置为'; drop table name_tbl;--,则可能会发生意外情况,请注意。 -
阅读,使用,快! stackoverflow.com/questions/60174/…
-
@AbraCadaver 不要担心以上数据仅供测试,感谢您的建议。
标签: php sql httprequest