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 " - <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() 함수 입니다.
출처: http://www.phpschool.com 작성자: 모션그래픽 |
|
|