Extract specific part of a string in PHP

前端 未结 4 1740
一整个雨季
一整个雨季 2021-01-14 01:03

I was simply wondering what would be the simplest and most efficient way of extracting a certain part of a dynamic string in PHP?

Per example, in this string:

<
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-14 01:43

    Try this

    $url = $_SERVER['REQUEST_URI'];
    $parsed_url = parse_url($url);
    $url_parts = explode('/',$parsed_url['path']);
    print_r($url_parts);
    

提交回复
热议问题