Home > Backend Development > PHP Tutorial > 怎样将print_r结果输出的txt文件里去?解决方案

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:16:44
Original
909 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:
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
Latest Issues
Print sql statement
From 1970-01-01 08:00:00
0
0
0
java - Print electronic form
From 1970-01-01 08:00:00
0
0
0
How to print key value in python for in
From 1970-01-01 08:00:00
0
0
0
Unable to print data
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template