假设您有两个网址。
http://testing.org/directory/index.php/arg1/arg2
Array ( [scheme] => http [host] => testing.org [path] => /directory/index.php/arg1/arg2 )
或者是这样的:
http://testing.org/index.php/arg1/arg2
Array ( [scheme] => http [host] => testing.org [path] => /index.php/arg1/arg2 )
我知道你可以用 parse_array() 分解 url。当我这样做时,路径就是“testing.org”之后的一切。在第一个示例中,数组中的路径变量 1 是“目录”,但在第二个示例中,路径变量 1 是“index.php”。
我想弄清楚做两件事的热度。首先删除 index.php 之后的所有内容,但我一直在摸索。另外,如何从第一个 url 中删除“/directory/”?
但我也想了解如何替换路径的一部分。