You are here: Re: parse_url question « PHP Programming Language « IT news, forums, messages
Re: parse_url question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация