You are here: Re: Explode + url faking problem « PHP Programming Language « IT news, forums, messages
Re: Explode + url faking problem

Posted by frizzle on 05/29/06 13:14

Bent Stigsen wrote:
> frizzle wrote:
> > Toby Inkster wrote:
> >> frizzle wrote:
> >>
> >>> Only now if there are two slashes behind each other
> >>> (folder//subfolder)
> >> Best thing is to make sure explode() never even sees that.
> >>
> >> <?php
> >> $url = 'folder//subfolder/////somefile';
> >>
> >> while (strstr($url, '//'))
> >> $url = str_replace('//', '/', $url);
> >>
> >> $parts = explode('/', $url);
> [snip]
> > Well, i figured right now, explode ignores it, and goes past it.
> > The way you present it, is axactly what it does right now w/o any
> > str_repl().
>
> Can you post an example of code that will do that. You must be doing
> something else that removes the empty values.
>
> > What i'd like is to have $array[1] to be empry or null, etc.
>
> That is what explode should give you, if you got nothing in between
> two separators. If you take Toby's code without the while/str_replace,
> then you should get:
> Array
> (
> [0] => folder
> [1] =>
> [2] => subfolder
> [3] =>
> [4] =>
> [5] =>
> [6] =>
> [7] => somefile
> )
>
>
> /Bent

function DefineLoc(){
$loc = explode('/', $_SERVER['QUERY_STRING'], ) );
return $loc;
};

The function worked that way for me. Also, when i had trailing slashes,
the current location would differ from w/o any trailing slashes.

Now i have this:
function DefineLoc(){
$loc = explode('/', trim( $_SERVER['QUERY_STRING'], '/' ) );
return $loc;
};

But that's also not as it should be but fixes the trailing problem.

Frizzle.

 

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

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