Jump to content

ways of passing data to included page


topcoder1

Recommended Posts

I know there are two ways to pass arguments to an included page.

1. declare variable in the main page, and the included page will have access to this variable by default scope.

in main.php

$test="hi";

<?php include("include1.php");?>

 

 

2. pass the argument from get

in main.php

<?php include("include1.php?test=hi");?>

 

the second way doesn't pollute the namespace but is limited to pass simple arguments(not arbitrary objects).  Is there any other way?

Link to comment
https://forums.phpfreaks.com/topic/105853-ways-of-passing-data-to-included-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.