개요
- PHP file()
- 파일 내용을 배열로 읽어들이는 PHP 함수
예시 1
root@zetawiki:~# cat greet.txt
hello world
good morning
$f = file('greet.txt');
var_dump( $f );
# array(2) {
# [0]=>
# string(12) "hello world
# "
# [1]=>
# string(13) "good morning
# "
# }
예시 2
$f = file('http://zetawiki.com/ex/txt/utf8hello.txt');
var_dump( $f );
# array(3) {
# [0]=>
# string(4) "Hi.
# "
# [1]=>
# string(8) "안녕.
# "
# [2]=>
# string(16) "おはよう。
# "
# }
같이 보기
- PHP readfile()
- PHP fopen()
- PHP fsockopen()
- PHP popen()
- PHP file_get_contents()
- PHP include
- PHP stream_context_create()