0
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w');

fwrite($fh, $contact_first_name);         



$result = user_profile_xml($data);

echo '<br>begin response:<br>';
echo '<pre>';
var_dump($result);
echo '</pre>';
echo'<br>end response<br>'; 

我想写 var_dump($result); 到文本文件

4

2 回答 2

1

var_dump 不返回任何内容,因此您不能将其放入另一个变量中。

请改用http://www.php.net/manual/en/function.var-export.php

于 2012-05-18T20:56:12.790 回答
1

试试 PHP5: 类 x { ... }

    $obj = new x();

    ob_start();              // open data buffer for echoed data
    var_dump($obj); 
    $var = ob_get_clean();   // return "echoed" data and free buffer
于 2014-02-05T12:55:07.010 回答