1. Use the basename function directly
basename()
The function returns the file name part of the path.
Online video tutorial sharing:php video tutorial
2. Use the pathinfo function
pathinfo()
The function takes an array Returns information about the file path.
3. Use the explode function
explode()
The function uses one string to split another string and returns an array composed of strings.
array explode ( string $delimiter , string $string [, int $limit ] )
Recommended related articles and tutorials:php tutorial
The above is the detailed content of What are the ways to get the file name in the path in php. For more information, please follow other related articles on the PHP Chinese website!