Home > Backend Development > PHP Tutorial > 如何将print_r的信息作为字符串返回

如何将print_r的信息作为字符串返回

WBOY
Release: 2016-06-06 20:52:15
Original
1020 people have browsed it

调试数组的时候,可以用print_r输出对象或者数组,我现在需要将这个错误信息变成字符串返回,sprintf貌似没有这个功能,有什么其他的函数可以做到么?

回复内容:

调试数组的时候,可以用print_r输出对象或者数组,我现在需要将这个错误信息变成字符串返回,sprintf貌似没有这个功能,有什么其他的函数可以做到么?

请使用var_export($array, true);函数

Related labels:
php
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