如何使用 phpinfo() 显示 PHP 信息?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6562221/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:43:50  来源:igfitidea点击:

How do I display PHP information using phpinfo()?

phpphpinfo

提问by Elmi Ahmadov

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

我有phpinfo()文本,我想将带有发布数据的文本发送到另一个 PHP 页面,并且我想在此页面上显示 PHP 信息。

My code:

我的代码:

File index.php

文件 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 :

文件 go.php :

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

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

发送phpinfo()带有发布数据的文本时如何显示 PHP 信息?

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

当我在index.php.php 中编写 phpinfo() 时,不在go.php.

回答by marchaos

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

我不确定我是否在关注您,但听起来您想捕获 phpinfo() 的输出。您可以使用输出缓冲来做到这一点:

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