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

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

WBOY
WBOYOriginal
2016-06-06 20:52:15981browse

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

回复内容:

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

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

Statement:
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