开发者

Execute die(); from another script

开发者 https://www.devze.com 2023-04-11 11:34 出处:网络
So how i can exectute die(); from one php script to another? ex.: 1.php <开发者_如何学JAVA;?php

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消