Advertisement
5_2007-2008 System Services/ Functions #183386

EZ Query string

I'm used to ASP so whaen i want to knwo the value of a variabl ein the querystring, i can just type in x = request.querystring("Name"). Well, now i made a function similar to this, it makes finding variables in the querystring Easy!

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
//main php file
include("querystring.php");
global $QUERY_STRING;
global $QS;
   //initialize Querystring
   $QS = Get_Query_String($QUERY_STRING);
   //get the variable
   $x = Get_QS("x",$QS);
   //print the variable!
   echo "x=".$x;
//querystring.php
<?php
function Get_Query_String($strQS) {
  $par = split("&",$strQS);
   for($i=0;$i<count($par);$i++) {
	  list($xQS[$i][0],$xQS[$i][1]) = split("=",$par[$i]);
   }
   return $xQS;
}
function Get_QS($varName,$QS_Array) {
	for($i=0;$i<count($QS_Array);$i++) {
    if($QS_Array[$i][0]==$varName) {
    	return $QS_Array[$i][1];
    }
  }
  return "";
}
?>
Upload
Původní komentáře (3)
Obnoveno z Wayback Machine