¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ñ¸ì¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS

PHP/¥Ç¥Ð¥Ã¥°

Last-modified: 2018-11-14 (¿å) 15:23:57 (2153d)
Top / PHP / ¥Ç¥Ð¥Ã¥°

PHP

PHP³«È¯¤ÇÌò¤ËΩ¤ÄTIPS¤Ç¤¹¡£

php.iniÀßÄê¤Ç¥Ç¥Ð¥Ã¥°É½¼¨¤µ¤ì¤Ê¤¤¾õÂ֤ΤȤ­¤Ë¡¢¤½¤ì¤ò²ò½ü¤¹¤ëÊýË¡

ini_set('display_errors', 1);

error_reporting¤Ç¥¨¥é¡¼½ÐÎÏÆâÍƤòÀ©¸æ

// Á´¤Æ¤Î¥¨¥é¡¼½ÐÎϤò¥ª¥Õ¤Ë¤¹¤ë
error_reporting(0);

// ñ½ã¤Ê¼Â¹Ô»þ¥¨¥é¡¼¤òɽ¼¨¤¹¤ë
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// E_NOTICE ¤òɽ¼¨¤µ¤»¤ë¤Î¤â¤ª¤¹¤¹¤á¡Ê½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¤ÊÑ¿ô¡¢ÊÑ¿ô̾¤Î¥¹¥Ú¥ë¥ß¥¹¤Ê¤É¡Ä¡Ë
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// E_NOTICE °Ê³°¤ÎÁ´¤Æ¤Î¥¨¥é¡¼¤òɽ¼¨¤¹¤ë
// ¤³¤ì¤Ï php.ini ¤ÇÀßÄꤵ¤ì¤Æ¤¤¤ë¥Ç¥Õ¥©¥ë¥ÈÃÍ
error_reporting(E_ALL ^ E_NOTICE);

// Á´¤Æ¤Î PHP ¥¨¥é¡¼¤òɽ¼¨¤¹¤ë¡Ê¥Ó¥Ã¥È 63 ¤Ï PHP 3 ¤ÇÍøÍѤµ¤ì¤ë¡Ë
error_reporting(E_ALL);

// error_reporting(E_ALL); ¤ÈƱ¤¸
ini_set('error_reporting', E_ALL);

PHPÀßÄêɽ¼¨

phpinfo();

ÇÛÎóÆâÍÆɽ¼¨

print_r(ÇÛÎóÊÑ¿ô̾); // ¤³¤ì¤¬°ìÈÖ¸«¤ä¤¹¤¤¤Î¤Ç¥ª¥¹¥¹¥á
var_export(ÇÛÎóÊÑ¿ô̾); // PHP¥³¡¼¥É·Á¼°¤ÇÆâÍÆɽ¼¨
var_dump(ÇÛÎóÊÑ¿ô̾); // ·¿¤ä¥µ¥¤¥º¤âɽ¼¨

ÇÛÎóÆâÍƤòWindows¾å¤Î¥Ä¡¼¥ë¤Çɽ¼¨

Windows¾å¤Çɽ¼¨ÍѤÎHTTPtrace¤È¤¤¤¦¥Ä¡¼¥ë¤ò¥µ¡¼¥Ð¤È¤·¤ÆÆ°¤«¤·¡¢¤½¤³¤ËÁ÷¤Ã¤Æɽ¼¨¤¹¤ëÊýË¡¤Ç¤¹¡£
¼¡¤Î¤è¤¦¤Ëµ­½Ò¤·¤Æ½ÐÎϤ·¤Þ¤¹¡£
USE_HTRACE¤òfalse¤ÈÄêµÁ¤¹¤ì¤Ð¡¢²¿¤â½ÐÎϤ·¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£

//define('USE_HTRACE', false);
require_once "htrace.php";

//htrace_set('localhost', 6007);
htrace($_SERVER);

²áµî¤È¾¿Í¤Ï¤«¤¨¤é¤ì¤Ê¤¤¤¬¡¢Ì¤Íè¤È¼«Ê¬¤Ï¤«¤¨¤é¤ì¤ë

¥³¥ó¥Ñ¥¤¥ë/¥í¡¼¥É¤µ¤ì¤Æ¤¤¤ëÁ´¤Æ¤Î¥â¥¸¥å¡¼¥ë¤Î̾Á°¤òɽ¼¨

print_r(get_loaded_extensions());

ÄêµÁºÑ¤ß´Ø¿ôɽ¼¨

$func_array = get_defined_functions();
print_r($func_array['internal']); // ¥Ó¥ë¥É¥¤¥ó´Ø¿ô
print_r($func_array['user']); // ¥æ¡¼¥¶ÄêµÁ´Ø¿ô
print_r($func_array); // ¤¹¤Ù¤Æ¤Î´Ø¿ô

ÄêµÁºÑ¤ßÊÑ¿ôɽ¼¨

$var_array = get_defined_vars();
print_r($var_array);

ÄêµÁºÑ¤ßÄê¿ôɽ¼¨

$constant_array = get_defined_constants();
print_r($constant_array);

¥ê¥ó¥¯