Execute die(); from another script
So how i can exectute die();
from one php script to another? ex.:
1.php
<开发者_如何学JAVA;?php
require("2.php");
sleep(2);
send_die_to_another_php("Success!", "2.php"); // Magic code
?>
2.php
<?php
sleep(10);
?>
You can't. PHP is single threaded; when you get to this line:
require("2.php");
that sleep(10)
in 2.php
(and everything else there) will get executed before anything else in 1.php
is run, because the require()
call doesn't return until its target file is fully evaluated.
精彩评论