gpt4 book ai didi

PHP 只获取完整路径的一部分

转载 作者:可可西里 更新时间:2023-11-01 00:38:22 26 4
gpt4 key购买 nike

我想知道如何只减去完整路径的一部分:

我得到当前文件夹的完整路径:

$dbc_root = getcwd(); // That will return let's say "/home/USER/public_html/test2"

我只想选择“/public_html/test2”

我该怎么做?谢谢!

最佳答案

我认为你应该检查路径相关的方法:

pathinfo() - Returns information about a file path
dirname() - Returns directory name component of path
basename() - Returns filename component of path

您应该能够找到其中之一的解决方案。

关于PHP 只获取完整路径的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2428013/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com