Incoming PHP scripts cannot access $ _POST while output buffering?

I have an HTML POSTing form for the following index.php:

<?php require_once("/home/full/path/to/included/file.php"); ?>

And in file.php, I'm trying to access $ _POST:

ob_start();
session_start();
var_dump($_POST);
$contents = ob_get_contents();
ob_end_clean();
echo $contents;

But var_dump ($ _ POST) returns an empty array.

Moving ob functions to index.php has no effect.

If I put var_dump ($ _ POST) before ob_start (), OR, if I delete output buffering at all, the problem will disappear, but I need output buffering. Therefore, trying to track down the problem, I tried POSTing the form data on test.php:

ob_start();
$session_start;
var_dump($_POST);
$contents = ob_get_contents();
ob_end_clean();
echo $contents;

. , file.php, , , . ? $_POST script? ? .

EDIT: : HTML:

<form action="/" method="POST">

mod_rewrite index.php. action = "/index.php", , .

+3
1

. , , ( "Location:..." ), file.php. script, $_POST. $_POST, , header().

, header() var_dump ($ _ POST). , header(), , ( "" ) , script. ?

( a la https://meta.stackexchange.com/questions/12513/should-i-not-answer-my-own-questions)

+2

Source: https://habr.com/ru/post/1758495/


All Articles