|
Posted by deko on 02/12/07 08:42
>> $ref = http://example.com/?p=32
>> $ref_a = parse_url($ref);
>> echo ref_a['path']; //returns nothing
> There are two syntax errors in your code:
>
> 1. $ref = http://example.com/?p=32 - you need quotes around this.
> 2. echo ref_a['path'] - you did not precede the variable name with $
>
> Once you fix those, the path element has a value of "/".
Yeah, that was a sloppy post.
But even after making your suggested corrections, the code is not returning
'/?p=32', but rather '/', as you pointed out. So I guess parse_url() does not
work when the url path contains a query string.
Navigation:
[Reply to this message]
|