Split URL by PHP
问题 Hi I'm a newbie in PHP and for my home project I need help where I want to split values with in a URL. $url = "http://localhost/Sub/Key/Key_XYZ_1234.php"; url can also be: $url = "http://localhost/Sub/Key/Key-XYZ-1234.php"; key value can be "ABC-TT" or "ABC_TT" or just "ABC" intended result $v1 = value of Key; $v2 = value of XYZ; $v3 = value of 1234; Thanks in advance 回答1: You can do this with a combination of parse_url, basename and preg_split. We use preg_split so we can deal with the