PHP clearstatcache () फ़ंक्शन
❮ पीएचपी फाइल सिस्टम संदर्भउदाहरण
आउटपुट फ़ाइल आकार, फ़ाइल को छोटा करें, कैश साफ़ करें, और फिर आउटपुट फ़ाइल आकार फिर से:
<?php
//output filesize
echo filesize("test.txt");
echo "<br />";
$file = fopen("test.txt", "a+");
// truncate file
ftruncate($file,100);
fclose($file);
//Clear cache and check filesize again
clearstatcache();
echo filesize("test.txt");
?>
उपरोक्त कोड का आउटपुट हो सकता है:
792
100
परिभाषा और उपयोग
Clearstatcache () फ़ंक्शन फ़ाइल स्थिति कैश को साफ़ करता है।
PHP बेहतर प्रदर्शन के लिए कुछ कार्यों के लिए डेटा कैश करता है। यदि किसी फ़ाइल की स्क्रिप्ट में कई बार जाँच की जानी है, तो संभवतः आप सही परिणाम प्राप्त करने के लिए कैशिंग से बचना चाहते हैं। ऐसा करने के लिए, clearstatcache() फ़ंक्शन का उपयोग करें।
वाक्य - विन्यास
clearstatcache(clear_realpath_cache, filename)
पैरामीटर मान
Parameter | Description |
---|---|
clear_realpath_cache | Optional. Indicates whether to clear the realpath cache or not. Default is FALSE, which indicates not to clear realpath cache |
filename | Optional. Specifies a filename, and clears the realpath and cache for that file only |
टिप्स और नोट्स
युक्ति: कार्य जो कैशिंग कर रहे हैं:
- स्टेट ()
- एलस्टैट ()
- फ़ाइल मौजूद()
- is_लिखने योग्य ()
- is_readable ()
- is_executable ()
- is_file()
- is_dir ()
- is_link ()
- फ़ाइल समय ()
- फ़ाइलटाइम ()
- फिल्म समय ()
- फाइलिनोड ()
- फ़ाइल समूह ()
- फ़ाइल मालिक ()
- फाइल का आकार()
- फाइल का प्रकार()
- फाइलपरम्स ()
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | कुछ भी तो नहीं |
---|---|
पीएचपी संस्करण: | 4.0+ |
पीएचपी चेंजलॉग: | PHP 5.3 - दो वैकल्पिक पैरामीटर जोड़े गए: clear_realpath_cahe और फ़ाइल नाम |
❮ पीएचपी फाइल सिस्टम संदर्भ