RE: [PHP] help how to transfer parameters .

From: Date: Mon, 20 Nov 2000 03:05:13 +0000
Subject: RE: [PHP] help how to transfer parameters .
Groups: php.general 
Request: Send a blank email to php-general+get-26184@lists.php.net to get a copy of this message
There are a few methods, depending on what you want to do; Note not all code below is guaranteed to work, look up in the manual for exact usage. 1. include / require 2. sessions 3. post / get vars 4. cookies (serialize data) 1. <?php $x=1; include "z.php"; ?> In z.php you have access to variables in the scope of the calling program. eg in z.php you can access $x 2. <?php $my_array=array("ni","hao"); session_register(); session_variable (my_array); ?> <?php session_register(); print "ni " . $my_array[1]; ?> Register a session, register the variables for that session, and you can access them in other programs if you open that session again. 3. <?php $my_array=array ("cats","dogs"); $x=serialize ($my_array); print "<a href="y.php?x=$x">; ?> y.php <?php if (isset($x)) { $my_array = unserialize ($x); } ?> 3.b make a submit form with hidden variables for your array. (too lazy to give example!) 4. SetCookie ("itsanarray",serialize($my_array),60*60*24*7*52,"\"); $my_array= unserialize ($itsanarray); Use whichever way suits your purposes. Sorry for being brief, just tired this morning ;) Cheers, Lawrence. -----Original Message----- From: forestwater [mailto:forestwater@sina.com] Sent: November 20, 2000 10:59 AM To: php-general@lists.php.net Subject: [PHP] help how to transfer parameters . How to transfer parameters between two php files . For example in one php script defined a array .How to use the array in other php script . Thanks ______________________________________ =================================================================== ÐÂÀËÃâ·Ñµç×ÓÓÊÏä http://mail.sina.com.cn ÐÂÀËÍÆ³ö°ÂÔ˶ÌÐÅÏ¢ÊÖ»úµã²¥·þÎñ http://sms.sina.com.cn/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#26184) next »