PHP बेसनाम () फ़ंक्शन
❮ पीएचपी फाइल सिस्टम संदर्भउदाहरण
निर्दिष्ट पथ से फ़ाइल नाम लौटाएं:
<?php
$path = "/testweb/home.php";
//Show filename
echo basename($path) ."<br/>";
//Show filename, but cut off file extension for ".php" files
echo basename($path,".php");
?>
उपरोक्त कोड का आउटपुट होगा:
home.php
home
परिभाषा और उपयोग
बेसनाम () फ़ंक्शन पथ से फ़ाइल नाम लौटाता है।
वाक्य - विन्यास
basename(path, suffix)
पैरामीटर मान
Parameter | Description |
---|---|
path | Required. Specifies a file path |
suffix | Optional. A file extension. If the filename has this file extension, the file extension will be cut off |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | निर्दिष्ट पथ का फ़ाइल नाम |
---|---|
पीएचपी संस्करण: | 4.0+ |
❮ पीएचपी फाइल सिस्टम संदर्भ