![](/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.