Re: Calling PHP from PHP

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

 



If you're not using an external program or script to run all your php scripts, but want one script to execute another, then include or require are the only methods that'll do the job. Putting the include / require -part in the end of the first script is exactly the same as running them both after each other.

Perhaps doing a header("Location: next-script.php"); will do what you ask, but I don't know if that works without a browser!

Mike



Alf Stockton skrev:
Mikael Grön wrote:
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

No neither would I recommend that solution and anyway I don't in any way want to do an include. If I was going to include then I may as well have coded that script into the "calling" script and duplicate the stuff all over my system. Maybe too much of my C programming background is showing but I just want to call another script, the same as one would in C by calling another program.


--
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