php - Get parameters and folders depth in a path -
how can take url path , break
- the params, in case
param1=1
,param2=2
- the end script,
levele
- the middle folders in script
levela, levelb, levelc, leveld
.
http://test.com/ levela/ levelb/ levelc/ leveld/ levele ? param1=1 & param2=2
another example this, folder depth different, , number of parameters different:
http://test.com/ levela/ levelb/ levelc/ leveld ? param1=1 & param2=2 & param3=3
use parse_url()
split url, , parse_str()
split query string components.
the levela/levelb/levelc
part best split using explode()
.
Comments
Post a Comment