note 123206 added to reserved.variables.server
| From: | razvan_bc.yahoo.com via php-notes | Date: | Sat, 06 Oct 2018 12:21:44 +0000 |
| Subject: | note 123206 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209384@lists.php.net to get a copy of this message | ||
In 2018 things can be pretty cool !!!
look around:
<?php
//save it index.php in a root folder
/*
if($_SERVER["REQUEST_METHOD"]!='GET'){
echo('it`s a POST');
}else{
echo('it`s a GET');
}
*/
$_REQ =& $_SERVER["REQUEST_METHOD"];
($_REQ=='POST')and($what='it`s a POST');
($_REQ=='GET')and($what='it`s a GET');
isset($what) and print($what);
?>
<form method="POST" action="">
<input type="text" name="postbaby" value="sadasdsa">
<input type="submit" value="POST THAT">
</form>
<br>
<form method="GET" action="">
<input type="text" name="getbaby" value="sadasdsa">
<input type="submit" value="GET THAT">
</form>
<hr><?php
phpinfo();
?>
what if you have a class with controllers?
i hope will not be depreciated cause STATIC CALLS I TEST ALREADY ARE VERY FAST:
<?php
//save it index.php in a root folder
/*
if($_SERVER["REQUEST_METHOD"]!='GET'){
echo('it`s a POST');
}else{
echo('it`s a GET');
}
*/
class forms {
public static function type(){
return $_SERVER["REQUEST_METHOD"];
}
public static function post($f){
(self::type()=='POST')and $f();
}
public static function get($f){
(self::type()=='GET')and $f();
}
}
?>
<form method="POST" action="">
<input type="text" name="postbaby" value="sadasdsa">
<input type="submit" value="POST THAT">
</form>
<br>
<form method="GET" action="">
<input type="text" name="getbaby" value="sadasdsa">
<input type="submit" value="GET THAT">
</form>
<hr><?php
forms::post(function(){
$what='it`s a POST';echo($what);
});
forms::get(function(){
$what='it`s a GET';echo($what);
});
//phpinfo();
?>
----
Server IP: 208.43.231.9
Probable Submitter: 5.13.53.84
----
Manual Page -- http://php.net/manual/en/reserved.variables.server.php
Edit -- https://master.php.net/note/edit/123206
Del: integrated -- https://master.php.net/note/delete/123206/integrated
Del: useless -- https://master.php.net/note/delete/123206/useless
Del: bad code -- https://master.php.net/note/delete/123206/bad+code
Del: spam -- https://master.php.net/note/delete/123206/spam
Del: non-english -- https://master.php.net/note/delete/123206/non-english
Del: in docs -- https://master.php.net/note/delete/123206/in+docs
Del: other reasons-- https://master.php.net/note/delete/123206
Reject -- https://master.php.net/note/reject/123206
Search -- https://master.php.net/manage/user-notes.php