赵一璐吧 关注:12贴子:246
  • 1回复贴,共1

PHP服务器变量$_SERVER详解

只看楼主收藏回复

1楼2011-08-26 11:06回复
    更好的,get和post都可以
    <?php
    $filename = 'notify.txt'; $get_content = $_GET; $post_content = $_POST; if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { echo $filename."can not open"; exit; } if ($get_content!="") { $time=date("Y-m-d H;i:s",time()); file_put_contents($filename, "\n\n".$time."GET\n----------------------------",FILE_APPEND); foreach ($get_content as $m_key => $m_value) { $key =$m_key ; $value =$m_value; file_put_contents($filename, "[".$key."]:".$value.",\n",FILE_APPEND); } } if ($post_content!="") { $time=date("Y-m-d H;i:s",time()); file_put_contents($filename, "\n\n".$time."POST\n----------------------------",FILE_APPEND); foreach ($post_content as $m_key => $m_value) { $key =$m_key; $value =$m_value; file_put_contents($filename, $key.'=>'.$value."\n",FILE_APPEND); } } } else { echo $filename."can not be written"; }
    if($_GET['look']=='all'){ $fh=fopen("notify.txt","r"); fpassthru($fh); }?>
    


    2楼2011-08-26 11:41
    回复