PHP GET:未定义的索引,即使访问日志显示它在那里

时间:2017-07-28 18:23:58

标签: php get

error_log中:

  

[7月28日星期五20:07:46.827740 2017] [fcgid:warn] [pid 5991] [client 79.146.9.122:48057] mod_fcgid:stderr:PHP注意:未定义索引:关闭/ home / x / public_html /第3行的mt4 / index.php

ACCESS_LOG:

  

79.146.9.122 - - [28 / Jul / 2017:20:07:46 +0200]" POST /mt4/index.php?close=0.06949000 HTTP / 1.1" 200 3" - " " MetaTrader 4 Terminal / 4.1090(Windows NT 5.1; x64)"

代码:

<?php
$f=fopen('eth-btc.json','w');
fwrite($f,$_POST['close']);
fclose($f);
echo 200;
?>

还尝试使用$_GET['close']$_REQUEST['close']

2 个答案:

答案 0 :(得分:1)

根据您的访问日志,它应为$_POST

  fwrite($f,$_POST['close']);

答案 1 :(得分:1)

使用$ _REQUEST ['close']代替$ _GET ['close']