PHP & Others

post, get, cookie, session 변수 확인

페이지 정보

본문

2차 배열까지 지원하며, 간단하게 넘어온 변수를 확인 할수 있는 스크립트입니다.


<?
$DebuggingMethod = 1;

function GetMethodType($CheckingMethod, $TranceMethod) {
       echo "-----------------------------------------------------------------<br>";
       echo "<font color='#999999'><b>" . $TranceMethod . "</b></font><br>";
       echo "-----------------------------------------------------------------<br>";
       $first_counter = 1;
       foreach ($CheckingMethod as $first_key => $first_value) {
              if ( is_array($first_value) ) {
                     $second_counter = 1;
                     foreach ($first_value as $second_key => $second_value) {
                            echo "&nbsp;- <font size=1>" . $second_counter . "</font>. " . $second_key . " = " . $second_value . "<br>";
                            $second_counter++;
                     }
              } else {
                     echo "<font size=1>" . $first_counter . "</font>. " . $first_key . " = " . $first_value . "<br>";
                     $first_counter++;
              }
       }
       echo "-----------------------------------------------------------------<br>";
}

if ( $DebuggingMethod ) {
       if ( $_POST ) {
              GetMethodType($_POST, "POST");
       }
       if ( $_GET ) {
              GetMethodType($_GET, "GET");
       }
       if ( $_COOKIE ) {
              GetMethodType($_COOKIE, "COOKIE");
       }
       if ( $_SESSION ) {
              GetMethodType($_SESSION, "SESSION");
       }
}
?>

-----------------------------------------------------------------------------
산이님 글

2차원 이상 배열을 지원하려면 자신의 함수를 호출하도록
짜면 됩니다.


그외 참고,

- object dump,
- 내장함수, 사용자 정의함수 목록 보기
- 정의된 상수와 그 값 보기
- 사용가능한 class 목록
- include, require 된 파일 목록
- 기타..

http://ftp.linuxchannel.net/devel/php_debug/

제가 자주 애용(?)하는 _debug() 함수 입니다.

관련자료

등록된 댓글이 없습니다.
Today's proverb
우리가 하는 모든 일은 우리 삶에서 비롯된다. 재충전을 위해서는 계속해서 자신을 비우고 더 많은 것을 받아야 한다. (베어 하트)