php pathinfo function usage: Return file path information in the form of an array. The syntax is "pathinfo(path, options)". The parameter path is required and refers to the path to be checked.
php The pathinfo() function is used to return file path information in the form of an array. Its syntax is pathinfo(path, options). The parameter path is required and refers to Specifies the path to be checked.
How to use php pathinfo function?
php pathinfo() function Syntax
Function: Return file path information in the form of an array.
Syntax:
pathinfo(path,options)
Parameters:
path required. Specifies the path to be checked.
process_sections Optional. Specifies the array elements to be returned. The default is all. Possible values: PATHINFO_DIRNAME - only dirname is returned. PATHINFO_BASENAME - only basename is returned. PATHINFO_EXTENSION - only extension is returned.
Description:
Returns an associative array containing path information. Including the following array elements: [dirname], [basename], [extension]
php pathinfo() function usage example
<?php $file = "/phpstudy/WWW/index.php"; print_r(pathinfo($file)) ; ?>
Output:
Array ( [dirname] => /phpstudy/WWW [basename] => index.php [extension] => php [filename] => index )
This article is an introduction to the PHP pathinfo function. I hope it will be helpful to friends in need!
The above is the detailed content of How to use php pathinfo function. For more information, please follow other related articles on the PHP Chinese website!