html - Call a php and return immediately -
i have call php "build.php" button action , php call python script , should return immediately.
the action:
<form method="get" action="build.php"> <input type="hidden" name="branch" value="master"> <input type="submit" value="build master" id="btnmaster"> </form>
the build.php
<?php if(isset($_get['branch'])) { $output = shell_exec('/usr/bin/python /users/testuser/gitroot/buildonguest.py --dest /users/testuser/builds --branch ' . $_get['branch'] . ' 2>&1 &'); } elseif (isset($_get['tag'])) { $output = shell_exec('/usr/bin/python /users/testuser/gitroot/buildonguest.py --dest /users/testuser/builds --tag ' . $_get['tag'] . ' 2>&1 &'); } ?>
so python script executed in background (&) , php should return main page. possible , how ?
if want redirect throght php, add header('location: /path/to/index.php');
after if
clause , return!!!
logically, should work :
<?php if(isset($_get['branch'])) { $output = shell_exec('/usr/bin/python /users/testuser/gitroot/buildonguest.py --dest /users/testuser/builds --branch ' . $_get['branch'] . ' 2>&1 &'); } elseif (isset($_get['tag'])) { $output = shell_exec('/usr/bin/python /users/testuser/gitroot/buildonguest.py --dest /users/testuser/builds --tag ' . $_get['tag'] . ' 2>&1 &'); } /* add here, appending $output value better understanding */ header('location: /path/to/index.php?status=$output'); ?>
Comments
Post a Comment