PHP 5.3.0 이후로 ereg() , eregi() 함수는 없어졌다. 아래와 같이 대체함수로 사용이 가능하다 예시) $pattern = 'abcd'; $string = 'abcdtest'; ereg($pattern," ",$string); // Bad; preg_match("/".$pattern."/"," ",$string); //Good! eregi($pattern," ",$string); // Bad; preg_match("/".$pattern."/i"," ",$string); // Good!
.html .htm .dat .inc 등 프로그램을 개발하다 보면 여러가지 확장자의 파일을 생성,수정 하게 된다. PHP Storm에서 각 확장자를 .php 파일로 인식하게 하여 좀더 수월하게 작업 할 수 있는 방법! 1. 메뉴 상단 File Tab 클릭 2. 서브메뉴에 Settings ( Ctrl + Alt + s) 를 클릭 3. Editor - File Types 로 들어가서 Recognized File Types 에서 PHP를 찾는다. 4.PHP를 찾아 마우스 포인터로 클릭 후, 하단 Registered Patterns에 +를 클릭하여 해당 확장자를 추가해준다. 6. Reassign wildcard 버튼 클릭한다. 7.원하는 확장자가 들어간걸 확인 후 OK 혹은 Apply 클릭한다.
PHP 5.3.0 이후로 ereg_replace , eregi_replace() 함수는 없어졌다. 아래와 같이 대체함수로 사용이 가능하다 예시) $pattern = 'abcd'; $string = 'abcdtest'; ereg_replace($pattern," ",$string); // Bad; preg_replace("/".$pattern."/"," ",$string); //Good! eregi_replace($pattern," ",$string); // Bad; preg_replace("/".$pattern."/i"," ",$string); // Good!
AH02429: Response header name 'Last-Modified ' 에러는 문서 상단에 header로 Ladt-Modified를 설정할 때 나타난다. header("Last-Modified: " .gmdate("D, M Y H : i: s") . " KST"); 형식으로 보통 많이 쓰는데 "Last-Modified: " 에서 공백이 들어가 나타나는 경우가 많다. 그러므로 아래와 같이 바꿔주자. 예시) header("Last-Modified: ".gmdate("D, M Y H : i: s") . " KST"); // Bad; header("Last-Modified:".gmdate("D, M Y H : i: s") . " KST"); // Good!
PHP Fatal error: Uncaught Error: Call to undefined function 주로 사용하고자 하는 함수가 선언되지 않았을 때 나타나는 오류. function을 사용 할 때 function명을 올바로 썼는지 혹은 function이 선언되어 있는지 확인해야 한다. 예시) // Bad; @include_once('/data/funcstions.php'); $test = call_the_function(); // Good! @include_once('/data/funcstions.php'); if(function_exists('call_the_function')){ $test = call_the_function(); }
PHP Fatal error: Cannot redeclare function() (previously declared in ~) 주로 상단에 include한 파일중에 이미 선언된 function 이름과 같은 function을 또 선언했을때 나타나는 오류. function_exists()로 선언하고자 하는 function 이름이 이미 선언되어 있는지 체크 필요. 예시) // Bad; @include_once '/data/functions.php'; function test_function(){ } // GOOD! @include_once '/data/functions.php'; if(function_exists('test_function') == false){ function test_function(){..