How can I have php return just some bytes of a file? Like, it I wanted to load byte 7 through 15 into a string, without reading any other part of the file? Its important that I don't need to load all of the file into memory, as the file could be quite large.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Using Pear:
Or:
Either method you can use byte 7-15 to do what you want. I don't think you can go after certain bytes without starting from the beginning of the file.
Could use file_get_contents() using the offset and maxlen parameters.
Use
fseek()
andfread()