Jump to content

Execute php scripts like a function call


ashly

Recommended Posts

Hi,

I have to execute multiple PHP scripts conditionally from a single PHP script, that is executed by a cron. Actually i wanted to do is instead of using require or include  for each page, execute each page directly from the script like a function call.

is there any methods in PHP? if anybody have any idea, pls reply..

 

Thanks

Ashly

Link to comment
https://forums.phpfreaks.com/topic/40308-execute-php-scripts-like-a-function-call/
Share on other sites

What if you just used addrees varibles to tell the php what to execute..

 

http://address.com/execute.php?prop1=1&prop2=1

 

The using requests:

 

$prop1 = $_REQUEST('prop1') ;

$prop2 = $_REQUEST('prop2') ;

 

if ($prop1 == 1) {

YOUR ECECUTE SCRIPT HERE ;

}

 

if ($prop2 == 1) {

YOUR ECECUTE SCRIPT HERE ;

}

 

 

Its pretty stright forward like exec and system

 

$command1 = "/bin/users/htdocs/test1.php" ;

$command2 = "/bin/users/htdocs/test2.php" ;

 

passthru($command1, $command2);

 

Make sure you use the whole path or it will return error 127.

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.