我在drupal节点内有一些评论,并尝试过
var_dump()
和
print_r()
看看他们之间的区别.
我想看看$comment对象的$content变量里面有什么.
我试过两个,我得到的是相同的输出!
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()非常易读和有序.但我怎么能理解那里发生的事情呢?
任何帮助将非常感谢!
谢谢!
尝试预先格式化它以获得更好的可读性:
原文链接:https://www.f2er.com/php/137058.htmlecho "<pre>"; print_r($some_var); echo "</pre>";