Problems with PHP Require and HTTP requests

just encountered a very unclear problem:

-sharp  B.php
...
die("AAAA");
require_once __DIR__ . "/../public/A.php";
die("b");
...

can die () come out. I wonder if there is anything special about this package of files, because I use POSTMAN to test what happens to OK, only when writing HTTP requests in PHP. I really don"t understand how to ask for advice

.
Mar.29,2021

you should write

dirname(__DIR__)."/xx.php"

__DIR__ . "/../xx.php"

a.php request timeout


the order in which PHP is executed is

  1. Top-to-bottom, left-to-right execution
  2. encounters file loading recursion 1-> 2

your error message is that the request timed out, so

require_once __DIR__ . "/../public/A.php";
die("b");

there is no die ("b"); the fetal error program has been interrupted.


well, first of all, thanks to the brothers who are eager to answer. Now the problem is solved: when initiating the request, I put Cookie: PHPSESSID=. this PHP on the head of the session in order to achieve the effect of using the same Cookie: PHPSESSID=. . It is estimated that there cannot be the same session ID so that the PHP cannot process (guess). Finally, the session of the requestor is directly transformed into json POST. The receiver receives a parameter to convert it to a new session

Menu