Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sharing object among all pages

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I have a large file that I would like
to read once and then have this object
be shared among all php pages at the
server. Can this be done? At the very least,
can this object persist from one invocation
of a given page to the next, so that
I am not forced to read the file every time?
 
Use sessions
<?
session_start();

session_register(&quot;TEXT&quot;);

$HTTP_SESSION_VARS['TEXT']= // the text you want

?>

in the other pages you only need:

<?
session_start();

// You can use $HTTP_SESSION_VARS['TEXT']

?>

P.S. If you are using PHP 4.1.0. You should swap the $HTTP_SESSION_VARS with the new global array $_SESSION, and you may skip the session_register command. Anikin
Hugo Alexandre Dias
Web-Programmer
anikin@ip.pt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top