不是var_dump()或print_r()都不会显示可读的信息.....,但输出却是令人困惑的.为什么? [英] Not var_dump() nor print_r() will show readable information.... but the same confusing output. Why?

查看:74
本文介绍了不是var_dump()或print_r()都不会显示可读的信息.....,但输出却是令人困惑的.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在drupal节点中有一些评论,并尝试过

I have some comments inside a drupal node, and tried

var_dump()

var_dump()

print_r()

print_r()

查看它们之间的区别. 我想看看$ comment对象的$ content变量里面有什么.

to see the difference between them. I want to see what´s inside $content variable of $comment object.

我都尝试过,得到的是相同的输出!

I´ve tried both and what I get is the same output!

array(5) { ["#printed"]=> bool(true) ["comment_body"]=> array(18) { ["#theme"]=> string(5) "field" ["#weight"]=> int(0) ["#title"]=> string(10) "Comentario" ["#access"]=> bool(true) ["#label_display"]=> string(6) "hidden" ["#view_mode"]=> string(4) "full" ["#language"]=> string(3) "und" ["#field_name"]=> string(12) "comment_body" ["#field_type"]=> string(9) "text_long" ["#field_translatable"]=> string(1) "0" ["#entity_type"]=> string(7) "comment" ["#bundle"]=> string(21) "comment_node_noticias" ["#object"]=> object(stdClass)#105 (25) { ["cid"]=> string(5) "37616" ["pid"]=> string(1) "0" ["nid"]=> string(4) "4355" ["uid"]=> string(4) "1411" ["subject"]=> string(30) "Esperemos que así sea, ya que" ["hostname"]=> string(15) "190.246.225.229" ["created"]=> string(10) "1307259450" ["changed"]=> string(10) "1307259450" ["status"]=> string(1) "1" ["thread"]=> string(3) "01/" ["name"]=> string(11) "dominguezpm" ["mail"]=> string(0) "" ["homepage"]=> string(0) "" ["language"]=> string(0) "" ["node_type"]=> string(21) "comment_node_noticias" ["registered_name"]=> string(11) "dominguezpm" ["u_uid"]=> string(4) "1411" ["signature"]=> string(0) "" ["signature_format"]=> NULL ["picture"]=> string(1) "0" ["new"]=> int(0) ["comment_body"]=> array(1) { ["und"]=> array(1) { [0]=> array(3) { ["value"]=> string(235) 

[...]

什么是可读"选项?我在某处读到print_r()可读性强且有序.但是我怎么知道那里发生了什么?

What is the "readable" otion? I´ve read somewhere that print_r() is quite readable and ordered. But how can I understand what´s going on in there?

任何帮助将不胜感激! 谢谢!

Any help will be very much appreciated! Thanks!

推荐答案

尝试对其进行预格式化以提高可读性:

try to preformat it for better readability:

echo "<pre>";
print_r($some_var);
echo "</pre>";

这篇关于不是var_dump()或print_r()都不会显示可读的信息.....,但输出却是令人困惑的.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆