Hello everyone
I would like to know if $_GET has a sort of a default value?
What I mean is this: I want to make my url as short as possible, something like
www.domain.com/?1
is this possible?
or it must be www.domain.com/?v=1
thanks!
| SitePoint Sponsor |
Hello everyone
I would like to know if $_GET has a sort of a default value?
What I mean is this: I want to make my url as short as possible, something like
www.domain.com/?1
is this possible?
or it must be www.domain.com/?v=1
thanks!
xxx.linguistmail.com
Learn A Foreign Language
Sentences Vocabulary Grammar Pronunciation
Apprendre l'anglais
Test itPHP Code:<?php var_dump( $_GET );
thanks logic_earth
is there an easy way not to display this:
array(1) { [123]=> string(0) "" }
I tried $myvar= var_dump ($_GET) but it still displays it.
I went on php.net and checked var_dump examples. In one of them, they suggest to use var_export($_GET, true) do you think it's ok?
xxx.linguistmail.com
Learn A Foreign Language
Sentences Vocabulary Grammar Pronunciation
Apprendre l'anglais
You could use the PATH_INFO element in $_SERVER, given the URL:-
You could grab 'banana' like so...Code:http://www.example.org/index.php/banana
With a little dash of Apache's mod_rewrite module thrown in, you could quite easily remove index.php from the URL.PHP Code:<?php
$var = trim($_SERVER['PATH_INFO'], '/');
?>
Alternatively, you could still use the query string.
You could grab 'banana' like so...Code:http://www.example.org/?banana
PHP Code:<?php
$var = $_SERVER['QUERY_STRING'];
?>
@AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.
Bookmarks