PHP 싱글쿼테이션(') 및 특수문자 처리PHP 싱글쿼테이션(') 및 특수문자 처리
Posted at 2012/05/23 09:58 | Posted in Dev/PHPDB에 Insert 나 Update 를 하다보면
특수 문자로 인해 제대로 작동하지 않을때가 있다
이럴때는 특수문자앞에 \ or \ (역슬래시) 를 넣어주면 되는데
이럴때
함수를 이용하면 된다.
$s = "aaa'aaa'aaa'aaa"
$s = addslashes($s) ;
결과 :aaa\'aaa\'aaa\'aaa
위의 결과를 원래대로 돌려줄때는
stripslashes()
함수를 이용하면 된다.
'Dev > PHP' 카테고리의 다른 글
| PHP 싱글쿼테이션(') 및 특수문자 처리 (0) | 09:58:57 |
|---|---|
| file_get_contents() Warning 오류 해결 방법 (0) | 2012/05/22 |
| [PHP] 이미지에 텍스트 합성 하기 (0) | 2012/04/05 |
| date() [function.date]: It is not safe to rely on the system's timezone settings. (0) | 2011/11/01 |
file_get_contents() Warning 오류 해결 방법file_get_contents() Warning 오류 해결 방법
Posted at 2012/05/22 11:33 | Posted in Dev/PHPWarning: file_get_contents() URL file-access is disabled in the server configuration in
php.ini 파일을 수정하여 file_get_contents 기능을 사용할수 있지만...
웹호스팅을 이용할 경우 php.ini 수정이 어렵다.
하지만, 오류를 해결하는 방법으로 외부 파일을 읽어 들이는 함수 이용전에
ini 설정을 임시로 변경해서 사용하면 된다.
@ini_set("allow_url_fopen","1");
'Dev > PHP' 카테고리의 다른 글
| PHP 싱글쿼테이션(') 및 특수문자 처리 (0) | 09:58:57 |
|---|---|
| file_get_contents() Warning 오류 해결 방법 (0) | 2012/05/22 |
| [PHP] 이미지에 텍스트 합성 하기 (0) | 2012/04/05 |
| date() [function.date]: It is not safe to rely on the system's timezone settings. (0) | 2011/11/01 |

