Re: Calling PHP from PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sidenote:

You can also do:
$dir = "folder/of/include/files";
$files = opendir($dir);
while ($file = readdir($file)):
   if (substr($file,-4) == '.php'):
      include_once($dir.'/'.$file);
   endif;
endwhile;

but I wouldn't recommend it. :P

Mike


John Comerford skrev:
Yes, what you have described  should work fine......


sam rumaizan wrote:
1- I have 50 php pages.
2- I want to include all 50 php pages in my main page. include("1.php"); ...... include("50.php"); My question is: can I put all of the include php pages in one php page and save it as includepages.php then include this php page to my main page include("includepages.php"); instead of listing all of the 50 pages include("1.php"); ...... include("50.php"); in my main page.
    Hartleigh Burton <hburton@xxxxxxxxxxxxxxxxxxxx> wrote:

Not sure if i understand properly... you don't want to use the include () function or you don't want to have the code of script B in script A?

If it is the later you can use include("path/to/scriptB.php"); or require("path/to/scriptB.php");

you can also use include_once() and require_once() if you want to make sure that script B is not used more than once.




If you don't want to use the include() or require() functions then I am not really sure.

I guess (providing you havn't already output headers) you could use header() to direct the browser... or if headers have already been sent you could use javascript to do a redirect?!


On 12/04/2007, at 3:18 PM, Alf Stockton wrote:

Please tell me how I call one PHP script from another?
On successful completion of script A I need to call script B without including it as part of script A.

--
Regards,
Alf Stockton www.stockton.co.za

Be cheerful while you are alive.
-- Phathotep, 24th Century B.C.
My email disclaimer is available at www.stockton.co.za/disclaimer.html

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






Regards,
Hartleigh.





       ---------------------------------
Don't get soaked. Take a quick peak at the forecast with theYahoo! Search weather shortcut.



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux