Php 如何隐藏var_转储输出?

Php 如何隐藏var_转储输出?,php,jquery,Php,Jquery,我试图在FTP中映射数据,但无法隐藏var\u dump的输出。 我的目标是获得输出,但作为邮箱中的通知。 把它放进我的邮箱不是问题。但问题是我无法隐藏输出。 以及以超链接的形式获取输出。 因此,我想隐藏,但使其成为我的邮箱中的超链接邮件 例如: ///////Mapping/////////////////////////////////////////// $host=$_SERVER['HTTP_HOST']; $rootpath = '.'; $fileinfos = new Recur

我试图在FTP中映射数据,但无法隐藏
var\u dump
的输出。 我的目标是获得输出,但作为邮箱中的通知。 把它放进我的邮箱不是问题。但问题是我无法隐藏输出。 以及以超链接的形式获取输出。 因此,我想隐藏,但使其成为我的邮箱中的超链接邮件

例如:

///////Mapping///////////////////////////////////////////
$host=$_SERVER['HTTP_HOST'];
$rootpath = '.';
$fileinfos = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootpath));
foreach($fileinfos as $pathname => $fileinfo) {
    if (!$fileinfo->isFile()) continue;
    var_dump('http://www.'.$host.(substr_replace($pathname,"/",0,2).'<br>'));
}
/////////////////////////////////////////////////////////
//映射///////////////////////////////////////////
$host=$\u服务器['HTTP\u主机'];
$rootpath=';
$fileinfos=新的递归迭代器(新的递归目录迭代器($rootpath));
foreach($fileinfos作为$pathname=>$fileinfo){
如果(!$fileinfo->isFile())继续;
var_dump('http://www.“.$host.”(substr_replace($pathname,“/”,0,2)。“
”); } /////////////////////////////////////////////////////////
三个选项:

1) 使用输出缓冲:

ob_start();
var_dump('http://www.'.$host.(substr_replace($pathname,"/",0,2).'<br>'));
$output = ob_get_clean();
3) 使用(请投票指出)

$output=var\u export('http://www.“.$host.”(substr_replace($pathname,“/”,0,2)。“
”);
将其放入HTML注释中,然后检查源代码

另一方面。。。var_dump不打算以这种方式使用。这是为了转储一个已经存在的变量,而不是一个仍然需要实例化的变量

///////Mapping///////////////////////////////////////////
$host=$_SERVER['HTTP_HOST'];
$rootpath = '.';
$fileinfos = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootpath));
foreach($fileinfos as $pathname => $fileinfo) {
    if (!$fileinfo->isFile()) continue;
    echo '<!---';
    var_dump('http://www.'.$host.(substr_replace($pathname,"/",0,2).'\n'));
    echo '--->';
}
/////////////////////////////////////////////////////////
//映射///////////////////////////////////////////
$host=$\u服务器['HTTP\u主机'];
$rootpath=';
$fileinfos=新的递归迭代器(新的递归目录迭代器($rootpath));
foreach($fileinfos作为$pathname=>$fileinfo){
如果(!$fileinfo->isFile())继续;
回声';
}
/////////////////////////////////////////////////////////

您可以使用它捕获var\u转储的输出,并将其存储在变量中以供以后使用。

不知何故,我没有使用该函数。接得好。
$output = var_export('http://www.'.$host.(substr_replace($pathname,"/",0,2).'<br>'));
///////Mapping///////////////////////////////////////////
$host=$_SERVER['HTTP_HOST'];
$rootpath = '.';
$fileinfos = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootpath));
foreach($fileinfos as $pathname => $fileinfo) {
    if (!$fileinfo->isFile()) continue;
    echo '<!---';
    var_dump('http://www.'.$host.(substr_replace($pathname,"/",0,2).'\n'));
    echo '--->';
}
/////////////////////////////////////////////////////////