Save PDF as a blob in a database using PHP?
问题 I have a PDF file on my server that I want to select and transform into a blob for insertion into my database (using an INSERT INTO command). My first problem is getting hold of the PDF using PHP. I know it is done with the file_get_contents() function, but I do not understand what parameters it needs. 回答1: $fp = fopen($fileLocation, 'r'); $content = fread($fp, filesize($fileLocation)); $content = addslashes($content); fclose($fp); You can save the $content to blob field in mysql 来源: https:/