PHP, virtual file from string without writing to hard disk

if I have a string (containing a pdf file) can I make a "virtual" file to avoid writing to the hard drive so that I can later use a function that requires an existing file?

// theorical code

$file=stringToVirtualFile($string);

require($file);

      

+3


source to share


1 answer


You can use php: // special memory to have a file descriptor that refers to data in memory instead of data written to the file. You can also use php: // temp to store a backup of the file (where the file will be written to disk if it exceeds 2MB by default).



+8


source







All Articles