move_uploaded_file() 함수를 사용할 때 다음과 같은 에러에 직면할 수 있다.



Warning: move_uploaded_file(upload/devIcon.gif): failed to open stream: Permission denied in /export/home/izeye/public_html/lim/example/upload_file.php on line 17

Warning: move_uploaded_file(): Unable to move '/var/tmp/phpnEaqpt' to 'upload/devIcon.gif' in /export/home/izeye/public_html/lim/example/upload_file.php on line 17



이 에러를 해결하기 위해서는

파일을 옮기고자 하는 디렉토리의 권한을 777로 변경해야만 한다.

여기에서는 다음 명령으로 upload 디렉토리를 777로 권한을 변경한다.



chmod 777 upload

Posted by 알 수 없는 사용자
,

PHP에서 여러 파일에 걸쳐 같은 내용이 반복될 경우

반복되는 내용을 하나의 파일로 만들어 포함시킬 수 있다.

반복의 예에는 함수, 헤더, 풋터 등이 있다.

파일을 포함시키기 위해 두 가지 키워드가 제공된다.

include()와 require() 함수가 제공되는데

에러처리를 제외한 모든 기능은 동일하다.

include()에서 에러가 발생하면 경고와 함께 실행을 계속하지만,

require()에서 에러가 발생하면 치명적 오류와 함께 실행을 중단하는 것이 다르다.

포함시키는 방식의 장점은

포함되는 파일을 수정해야되는 경우 포함되는 파일 하나만을 수정하면

포함하는 파일 모두에 반영됨으로써 작업 시간을 줄여줄 수 있다.

하지만 포함되는 파일의 내용을 각 포함하는 파일이 가지고 있었다고 한다면

그 파일들을 모두 찾아서 수정해야만 하는 번거로움이 있다.

다음을 참고하기 바란다.



You can insert the content of a file into a PHP file before the server executes it, with the include() or require() function. The two functions are identical in every way, except how they handle errors. The include() function generates a warning (but the script will continue execution) while the require() function generates a fatal error (and the script execution will stop after the error).

These two functions are used to create functions, headers, footers, or elements that can be reused on multiple pages.

This can save the developer a considerable amount of time. This means that you can create a standard header or menu file that you want all your web pages to include. When the header needs to be updated, you can only update this one include file, or when you add a new page to your site, you can simply change the menu file (instead of updating the links on all web pages).



일반적으로 include()보다는 require()를 사용할 것을 권장한다.

왜냐하면 파일이 없거나 파일 이름이 잘못된 상황에서

스크립트가 계속 실행되길 원하지 않을 것이기 때문이다.

다음을 참고하기 바란다.



It is recommended to use the require() function instead of include(), because scripts should not continue executing if files are missing or misnamed.



Reference:
http://www.w3schools.com/php/php_includes.asp

Posted by 알 수 없는 사용자
,

타임스탬프란 1970년 1월 1일 00:00:00를 기준으로 경과한 초를 의미한다.

이것은 PHP뿐만 아니라, 유닉스 시스템에서도 마찬가지이다.

다음 글을 참고하기 바란다.



A timestamp is the number of seconds since January 1, 1970 at 00:00:00 GMT. This is also known as the Unix Timestamp.



Reference:
http://www.w3schools.com/php/php_date.asp
Posted by 알 수 없는 사용자
,