считать файл в строку php
Primary tabs
string fread (указатель на файл, длина) ;
пример =
<?php // get contents of a file into a string $filename = "/usr/local/something.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); ?>
fread() reads up to length bytes from the file pointer referenced by handle. Reading stops as soon as one of the following conditions is met:
length bytes have been read
EOF (end of file) is reached
a packet becomes available or the socket timeout occurs (for network streams)
if the stream is read buffered and it does not represent a plain file, at most one read of up to a number of bytes equal to the chunk size (usually 8192) is made; depending on the previously buffered data, the size of the returned data may be larger than the chunk size.
_____________________________________________
Источники(читать подробнее)=
http://www.znannya.org/?view=PHP_file_read
Ключевые слова и фразы(для поиска)=
- Log in to post comments
- 4199 reads