Summary of path operations in PHP

Source: Internet
Author: User
: This article mainly introduces PHP's summary of path operations. For more information about PHP tutorials, see. In PHP, there are also related functions for path operations.
1. parse_url
The information obtained by this method is the most detailed. you can obtain schme, host, path, and so on. This function is required. for detailed usage, see http://php.net/manual/en/function.parse-url.php.
2. basename
Get the basic file name of the file in the url:
For example, the content returned by basename ('www .baidu.com/hell/test/ini.php') is ini. php;
With the second parameter, you can remove the suffix in the file name:
For example, the content returned by basename ('www .baidu.com/hell/test/ini.php', '. php') is ini;
Note:
For example, after basename ('www .baidu.com/hell/test/') passes through this function, test is returned;
Detailed reference http://php.net/manual/zh/function.basename.php
3. dirname
Get the path name of the file in the url:
Dirname ('www .baidu.com/hell/test/ini.php') returns www.baidu.com/hell/test
4. pathInfo
Get the dirname and basename content directly.
5. explode
Split string
6. substr
Substring
7. join
Concatenate strings in the array
8. implode
Convert the array into a string. you can also say that the connected string is the alias of join. the two functions are the same.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.