![](/img/trans.png)
[英]How can i retrieve a particular data from a content obtained using file_get_contents() function in PHP?
[英]how can I use the function of file_get_contents in php to read the file content in a specific folder?
例如,我在/ upload文件夾中有一個圖像文件。 如何使用php中的file_get_contents函數獲取/ upload文件夾(特定目錄)中文件的信息。 我需要包含哪些參數?
這完全取決於當前文件所在的文件夾。
如果您使用其他文件夾中的文件中的file_get_contents(../upload/filename)
: file_get_contents(../upload/filename)
。
如果您使用上載文件夾中文件中的file_get_contents('filename')
: file_get_contents('filename')
如果您使用上載文件夾的子文件夾中的文件中的file_get_contents('../filename')
: file_get_contents('../filename')
file_get_contents- >將整個文件讀入字符串
getimagesize- >從圖像獲取信息。
對於圖像,您可以使用GD庫,exif或imagemagick庫,它們幾乎在每個PHP安裝中都很常見。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.