Re: php url question [message #180568 is a reply to message #180566] |
Tue, 26 February 2013 20:41 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 2/26/2013 2:41 PM, Kevin Davis wrote:
> On Tuesday, February 26, 2013 11:45:47 AM UTC-6, Jerry Stuckle wrote:
>> On 2/26/2013 12:28 PM, Kevin Davis wrote:
>>
>>> Hi there,
>>
>>>
>>
>>> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>>
>>>
>>
>>> Thank you.
>>
>>>
>>
>>
>>
>> What have you tried?
>>
>>
>>
>
> One option that I'm trying is $_SERVER['PATH_INFO'] instead of $_SERVER['REQUEST_URI']
>
OK, that will get you the 't2', if that's what you want. A longer way
would be to explode it on the '?'.
$array = explode('?', $_SERVER['REQUEST_URI']);
$array[0] will contain the request. If there are parameters, they will
be in $array[0] (and you could explode that also, but it's all in the
$_GET superglobal anyway).
Is this a case where you're using .htaccess to redirect pages (i.e. in a
CMS)? I'm wondering, because normally scripts know how they were called
(based on the filename). About the only place I've needed such is for
an intelligent error processing page (i.e. 404 Not Found message).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|