php POST ile gelen değişkenleri ve değerlerini ekrana yazdırma
Merhabalar… Yeni yazmaya devam ettiğim “Dahi Portal” sistemimde post ile gelen tüm değişkenlerin adlarını ve değerlerini görmem gerekti. Biraz arayınca aşağıdaki kodları buldum. Umarım sizinde işinize yarar…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php $query_string = ""; if ($_POST) { $kv = array(); foreach ($_POST as $key => $value) { $kv[] = "$key=$value"; } $query_string = join("&", $kv); } else { $query_string = $_SERVER['QUERY_STRING']; } echo $query_string; ?> |
Ekran çıktısı
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
"REDIRECT_STATUS" => "200" "HTTP_HOST" => "uzman.my" "HTTP_CONNECTION" => "keep-alive" "HTTP_CACHE_CONTROL" => "max-age=0" "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" "HTTP_UPGRADE_INSECURE_REQUESTS" => "1" "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" "HTTP_REFERER" => "http://uzman.my/kalite/revizyon?kategori_id=1&dokuman_adi=&dokuman_no=&yeterlilik_id=&yeterlilikbirimi_id=&teknik_onay_durumu=&bilgi_islem_durumu=&kalite_onay=& ▶" "HTTP_ACCEPT_ENCODING" => "gzip, deflate" "HTTP_ACCEPT_LANGUAGE" => "tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4" "HTTP_COOKIE" => "XSRF-TOKEN=eyJpdiI6IjlwTmdKWU1pNHd2bnIxM1F1SEY0ZUE9PSIsInZhbHVlIjoiT1B0czhHR0hxa2RlbWFpSEVnR0FURkJNeWhENkNZTG9PT3lwWmRrbExIWGh0dDdHNU9cLzVQampKOFdVcThUallPcEVYV ▶" "PATH" => "C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window ▶" "SystemRoot" => "C:\Windows" "COMSPEC" => "C:\Windows\system32\cmd.exe" "PATHEXT" => ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" "WINDIR" => "C:\Windows" "SERVER_SIGNATURE" => "<address>Apache/2.4.23 (Win64) PHP/7.0.10 Server at uzman.my Port 80</address>\n" "SERVER_SOFTWARE" => "Apache/2.4.23 (Win64) PHP/7.0.10" "SERVER_NAME" => "uzman.my" "SERVER_ADDR" => "127.0.0.1" "SERVER_PORT" => "80" "REMOTE_ADDR" => "127.0.0.1" "DOCUMENT_ROOT" => "C:/wamp64/www/uzmanmy/public" "REQUEST_SCHEME" => "http" "CONTEXT_PREFIX" => "" "CONTEXT_DOCUMENT_ROOT" => "C:/wamp64/www/uzmanmy/public" "SERVER_ADMIN" => "wampserver@wampserver.invalid" "SCRIPT_FILENAME" => "C:/wamp64/www/uzmanmy/public/index.php" "REMOTE_PORT" => "64410" "REDIRECT_URL" => "/kalite/revizyon/2/edit" "GATEWAY_INTERFACE" => "CGI/1.1" "SERVER_PROTOCOL" => "HTTP/1.1" "REQUEST_METHOD" => "GET" "QUERY_STRING" => "" "REQUEST_URI" => "/kalite/revizyon/2/edit" "SCRIPT_NAME" => "/index.php" "PHP_SELF" => "/index.php" "REQUEST_TIME_FLOAT" => 1507280745,707 "REQUEST_TIME" => 1507280745 |
Alıntı http://www.php.net/manual/tr/reserved.variables.post.php