gpt4 book ai didi

php - 需要帮助用 PHP 剪切字符串

转载 作者:行者123 更新时间:2023-12-04 16:06:26 26 4
gpt4 key购买 nike

我有一个字符串:

$str = "http://www.abc.com/xxx/xxx/v54/c505/1.html";

如何截断尾随的 1.html

我想要的结果是http://www.abc.com/xxx/xxx/v54/c505/

最佳答案

使用dirname()

$newStr = dirname($str) . '/';

关于php - 需要帮助用 PHP 剪切字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7142916/

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