In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces php how to get the file name without suffix, the article is very detailed, has a certain reference value, interested friends must read it!
Get method: 1, use basename () function, syntax "basename (file path, need to remove suffix name)"; 2, use pathinfo () function, syntax "pathinfo (file path, PATHINFO_FILENAME)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The method of getting the file name without suffix by php
1. Use the basename () function
The basename () function returns the filename portion of the path. Syntax:
Basename (path,suffix)
Parameter path: indicates the path to be checked.
Parameter suffix: can be omitted to indicate the file extension. If the suffix parameter is not omitted, the file name without the extension is output.
Example:
Output:
Home.phphome
2. Use the pathinfo () function
The pathinfo () function returns information about the file path as an array. Syntax:
Pathinfo (path,options)
Parameter path: indicates the path to be checked.
The parameter options: can be omitted to indicate the array elements to be returned. The default value is all. You can have the following values:
PATHINFO_DIRNAME: only the directory name (dirname) is returned.
PATHINFO_BASENAME: returns the full file name (basename), that is, the file name with the extension.
PATHINFO_EXTENSION: returns only the extension (extension)
PATHINFO_FILENAME: returns the file name without an extension (filename).
Example:
Output:
Demo above is all the content of the article "how to get a file name without a suffix by php". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.