Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi.
I created these PHP scripts, in order to execute 'foo.php' by using 'ob_start' via another script ('admin.php').
'foo.php' requires some libraries ('functions_for_foo.php' where some arrays are handled) and 'admin.php' requires other libraries ('functions_for_admin.php').
array_info.phpCode: Select all
$myList = array ("John", "Mary");Code: Select all
require_once("array_info.php");
require_once("functions_for_foo.php");
manageArray();functions_for_foo.php
Code: Select all
function manageArray()
{
global $myList;
print_r($myList);
}admin.php
Code: Select all
// OPTION 1
// require_once("functions_for_admin.php");
// doInclude();
// END OPTION 1
// OPTION 2
ob_start();
chdir('/usr/local/httpd/htdocs/');
include('/usr/local/httpd/htdocs/foo.php');
$out = ob_get_contents();
ob_end_clean();
print "<li>GOT CONTENTS:\n";
print $out;
// END OPTION 2Code: Select all
function doInclude()
{
ob_start();
chdir('/usr/local/httpd/htdocs/');
include('/usr/local/httpd/htdocs/foo.php');
$out = ob_get_contents();
ob_end_clean();
print "<li>GOT CONTENTS:\n";
print $out;
}Just the same if I don't call 'functions_for_foo.php' within 'foo.php' (got array info if I don't call functions).
Any similar experience?
Thank you very much.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]