Re: Calling PHP from PHP

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

 



header("Location:next-script.php"); would work as long as nothing has been written to the screen. You can write to a DB, a cookie, a session, a file, etc, though to keep data flowing.
 
Thank you,
Jarrett Meyer
http://jarrettmeyer.blogspot.com

No trees were harmed during this transmission; however, several electrons were terribly inconvenienced.

----- Original Message ----
From: Mikael Grön <php@xxxxxxxx>
To: php-windows@xxxxxxxxxxxxx
Sent: Thursday, April 12, 2007 10:41:28 AM
Subject: Re: [PHP-WIN] Calling PHP from PHP

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