PHP फ़ाइल () फ़ंक्शन
❮ पीएचपी फाइल सिस्टम संदर्भउदाहरण
एक फ़ाइल को एक सरणी में पढ़ें:
<?php
print_r(file("test.txt"));
?>
परिभाषा और उपयोग
फ़ाइल () एक फ़ाइल को एक सरणी में पढ़ता है।
प्रत्येक सरणी तत्व में फ़ाइल से एक पंक्ति होती है, जिसमें न्यूलाइन वर्ण अभी भी संलग्न है।
वाक्य - विन्यास
file(filename, flag, context)
पैरामीटर मान
Parameter | Description |
---|---|
filename | Required. Specifies the path to the file to read |
flag |
Optional. Can be one or more of the following constants:
|
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. Can be skipped by using NULL. |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | एक सरणी में संपूर्ण फ़ाइल, विफलता पर FALSE |
---|---|
पीएचपी संस्करण: | 4.0+ |
बाइनरी सुरक्षित: | हाँ, PHP 4.3 . में |
❮ पीएचपी फाइल सिस्टम संदर्भ