Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15268
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Is there a better way? |
| Date | 2015-04-16 01:25 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <mgn31q$agi$5@dont-email.me> (permalink) |
| References | <767d57a3-1f14-4714-a063-53c53973ecbf@googlegroups.com> <czlr2z0318lc.1qplhidk22fv7.dlg@40tude.net> |
On Wed, 15 Apr 2015 15:04:52 -0400, richard wrote:
> On Mon, 13 Apr 2015 19:47:36 -0700 (PDT), Paul Knaggs wrote:
>> The code is an extract from function.php used in a dynamic page
>> "request.php?=123"
> I just have to ask.
> What exactly is =123?
I don't know, the url being shown is "request.php?=123" with the ?
preceding the =123.
? starts the query string in a GET request which is usually one or more
name=value pairs separated by ampersands, and which can be accessed with
php using the $_GET[] array. Additionally the whole query string is
accessible as $_SERVER['QUERY_STRING'], in which case php code can parse
it as a string, rather than by using the $_GET[] array.
"request.php?=123" will generate an empty $_GET[] array, but will place
the string "=123" in $_SERVER['QUERY_STRING'].
The following php can be used to demonstrate this (if it formats
correctly, or maybe even if if it doesn't).
<?php
$get = print_r($_GET, true);
echo <<< EOT
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>"qs vs get"</title>
<style type="text/css">
body{margin: 1em 3em}
table{border-collapse: collapse}
td{border: thin solid black; padding:1em}
</style>
</head>
<body>
<table>
<tr>
<td>\$_SERVER['QUERY_STRING']:</td>
<td>{$_SERVER['QUERY_STRING']}</td>
</tr>
<tr>
<td>\$_GET[]:</td>
<td><pre>{$get}</pre></td>
</tr>
</table>
</body>
</html>
EOT;
--
Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there a better way? Paul Knaggs <paul@tagmebands.co.uk> - 2015-04-13 19:47 -0700
Re: Is there a better way? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-14 07:54 -0400
Re: Is there a better way? Paul Knaggs <paul@tagmebands.co.uk> - 2015-04-15 04:40 -0700
Re: Is there a better way? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-15 11:01 -0400
Re: Is there a better way? richard <noreply@example.com> - 2015-04-15 15:04 -0400
Re: Is there a better way? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-15 15:40 -0400
Re: Is there a better way? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-15 17:14 -0400
Re: Is there a better way? richard <noreply@example.com> - 2015-04-15 20:02 -0400
Re: Is there a better way? Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-16 15:18 +0000
Re: Is there a better way? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-22 17:17 +0200
Re: Is there a better way? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2015-04-15 20:56 +0000
Re: Is there a better way? Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-16 01:25 +0000
Re: Is there a better way? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2015-04-17 07:35 -0700
Re: Is there a better way? richard <noreply@example.com> - 2015-04-17 11:52 -0400
Re: Is there a better way? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2015-04-17 10:04 -0700
Re: Is there a better way? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-17 13:22 -0400
Re: Is there a better way? richard <noreply@example.com> - 2015-04-17 14:49 -0400
Re: Is there a better way? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2015-04-17 12:20 -0700
Re: Is there a better way? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-17 15:27 -0400
Re: Is there a better way? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2015-04-17 10:30 -0700
Re: Is there a better way? richard <noreply@example.com> - 2015-04-17 14:56 -0400
Re: Is there a better way? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2015-04-17 12:25 -0700
Re: Is there a better way? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-17 15:29 -0400
Re: Is there a better way? Tim Streater <timstreater@greenbee.net> - 2015-04-17 22:19 +0100
Re: Is there a better way? Richard Yates <richard@yatesguitar.com> - 2015-05-24 15:22 -0700
csiph-web