Advertisement
7_2009-2012 System Services/ Functions #228422

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

สรุปโดย 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.

ซอร์สโค้ด
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
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine