본문 바로가기

프로그래밍/PHP10

How to create a self extracting PHP script How to create a self extracting PHP script By Justin Silverton PHP has a built-in command called __HALT_COMPILER__. This command Halts the execution of the compiler. This can be useful to embed data in PHP scripts. Below is an example of a self-extracting php script. When executed, a second php file will be extracted in the same directory called testscript1.php. 2008. 8. 20.
[PHP] 파일 UTF-8저장시 BOM(Byte Order Mark) 의 문제....... 에디트 플러스를 이용해 UTF-8 로 저장을 하게 되면 BOM 이생긴다. 그로 인해 session_start(); 와 같은 함수가 사용될시 headers already sent 에러가 발생이 된다. 소스상에는 분명 output 된곳이 없지만, 에러가 발생된다. 이유인즉 UTF-8로 저장시 자동으로 UTF-8을 인식하는 BOM이 추가되는것이다. 그렇다면 BOM 이란 녀석은 뭐하는 놈인가? http://en.wikipedia.org/wiki/Byte_Order_Mark 이곳에서 정답을 찾으세요~!! 바이트 순서 표식 editplus v 2.30 에서 BOM 제거 설정은 Tools > Preferences > Files > UTF-8 signature 항목에서 세번째인 Always remove signatur.. 2008. 8. 20.
[PHP] 파일시스템에 접근하지 않고 realpath 와 같은 기능을 하는 함수 Because realpath() does not work on files that do not exist, I wrote a function that does. It replaces (consecutive) occurences of / and \\ with whatever is in DIRECTORY_SEPARATOR, and processes /. and /.. fine. Paths returned by get_absolute_path() contain no (back)slash at position 0 (beginning of the string) or position -1 (ending) 2008. 8. 19.
[PHP] 폴더 경로 변경 함수 Looks like a lot of people are looking for an 'unrealpath' or 'relative-path' function, returning the relative path from a directory to another one (in most cases ./). Unfortunately it's kinda difficult to program such a function which really works correctly, with any type of path. Most of the posted functions have some little bugs. I compared the following functions: - unrealpath() by Zach Bern.. 2008. 8. 19.