怎样将print_r结果输出的txt文件里去?解决方案

WBOY
Release: 2016-06-13 10:16:44
Original
868 people have browsed it

怎样将print_r结果输出的txt文件里去?
怎样将print_r结果输出的txt文件里去?


------解决方案--------------------
print_r

可以带第二个参数,翻手册
------解决方案--------------------
$s = print_r($var, true);
file_put_contents('arr.txt', $s);


------解决方案--------------------

PHP code
<?phpob_start ();// ... do something// 输出要保存到记事本的内容// print_r(array('hello', 'wolrd'));$data = ob_get_contents();ob_end_clean();$flink = fopen('arr.txt', 'w');fwrite($flink, $data);?><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template