Get the App
SLTechnology News&Howtos  ›  Development  › 

How PHP uses the file_get_contents() function

Shulou Source: shulou.com Published: 2022-06-01 02:34:03 09月21日 Update

This article mainly introduces PHP how to use the file_get_contents () function, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.

File_get_contents ();-- reads the entire file into a string

String file_get_contents (string $filename [, bool $use_include_path = false [, resource $context [, int $offset =-1 [, int $maxlen]) / / is the same as file (), except that file_get_contents () reads the file into a string. Reading of content of length maxlen starts at the location specified by the parameter offset. If it fails, file_get_contents () returns FALSE.

Parameter: filename: the name of the file to read.

Use_include_path:As of PHP 5 the FILE_USE_INCLUDE_PATH can be used to trigger include path search.

Context:A valid context resource created with stream_context_create (). If you don't need custom context, you can use NULL to ignore it.

Header ("Content-Type:Text/html;charset=utf8"); / / PHP 5$ file = file_get_contents ('d Vega hand Test.txtact, FILE_USE_INCLUDE_PATH); echo $file / / results / / this is test//this is test Thank you for reading this article carefully. I hope the article "how PHP uses the file_get_contents () function" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles files functions parameters characters strings values locations interests content at the same time names more friends knowledge results ribbons industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Tech Info Redmi OPPO Reno Xiaomi