du970294 2013-01-08 15:43
浏览 83

有没有办法解析print_r的输出[重复]

Possible Duplicate:
Create array printed with print_r

Duplicate of How create an array from the output of an array printed with print_r? which also has a nice code example to solve this

I need to reverse an error log which has as output print_r($data,true).
Example data would look like:

Array
(
    [subject] => this is the subject
    [body] => <p>Dear user,</p><p>this is the body of the email</p>
    [from_id] => 0
    [from_email] => admin@karakas.org
    [to] => Array
        (
            [0] => Array
                (
                    [id] => 0
                    [email] => 64909
                )

        )

    [send_to_inbox] => 1
)
  • 写回答

2条回答 默认 最新

  • doulan1073 2013-01-08 15:51
    关注

    In the PHP manual there's a print_r_reverse() function in comments : http://php.net/manual/en/function.print-r.php

    However var_export() can be an alternative if your logs are generated using var_export(). This way, you only need eval() to retrieve the exported array.

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统