Чтобы разбить его:
function get_text($filename) { //Defines the function, taking one argument - Filename, a string.
$fp_load = fopen("$filename", "rb"); //Opens the file, with "read binary" mode.
if ($fp_load) { // If it's loaded - fopen() returns false on failure
while (!feof($fp_load)) { //Loop through, while feof() == false- feof() is returning true when finding a End-Of-File pointer
$content .= fgets($fp_load, 8192); // appends the following 8192 bits (or newline, or EOF.)
} //Ends the loop - obviously.
fclose($fp_load); //Closes the stream, to the file.
return $content; //returns the content of the file, as appended and created in the loop.
} // ends if
} //ends function
Я надеюсь, что это помогает.
Выработать на 8192:
Чтение заканчивается, когда длина - 1 байт чтения или перевода строки (который входит в стоимость возврата) или EOF (что наступит первым). Если длина не указана, она будет продолжать чтение из потока, пока не достигнет конца строки.
от: http://php.net/manual/en/function.fgets.php
не ставят '$ filename' в кавычках на' FOPEN() 'вызова. Это не имеет большого смысла. –
Я просто использовал то, что использовал Panique (как упоминалось), в любом случае он работает – Xtremefaith