How to display PHP info using phpinfo ()?

I have phpinfo()and I want to send the text with the post data to another PHP page, and I want to display the PHP information on this page.

My code is:

File index.php

<html>
<form action = "go.php" method = "post">
<input type = "text" name = "msg"><br><br>
<input type = "submit" value = "Submit">
</form>
<html>

File go.php :

<?
    $message = $_POST['msg'];
    echo "Message : $message<br>";
?>

How can I show PHP info when posting phpinfo()with post data?

When I write phpinfo () in index.php, I do not show PHP information in go.php.

+11
source share
1 answer

I'm not sure I will follow you, but it looks like you want to capture the output of phpinfo (). You can do this with output buffering:

<?php
ob_start();
phpinfo();
$info = ob_end_clean();
?>
+11
source

All Articles