|
Posted by Rik on 02/12/07 08:54
On Mon, 12 Feb 2007 09:42:50 +0100, deko <deko@nospam.com> wrote:
>>> $ref =3D http://example.com/?p=3D32
>>> $ref_a =3D parse_url($ref);
>>> echo ref_a['path']; //returns nothing
>
>> There are two syntax errors in your code:
>>
>> 1. $ref =3D http://example.com/?p=3D32 - 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=3D32', but rather '/', as you pointed out. So I guess =
=
> parse_url() does not work when the url path contains a query string.
Please read the manual when having questions about a specific function. =
=
The query string is a separate part of the url...
http://www.php.net/parse_url
-- =
Rik Wasmus
[Back to original message]
|