Making PHP var_dump() values display one line per value

前端 未结 14 1318
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 15:41

When I echo var_dump($_variable), I get one long, wrapping line with all varable\'s and values like

[\"kt_login_user\"]=>  string(8) \"teacher1\" [\"kt_lo         


        
14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 16:42

    I've also researched this issue and not found the right answer. This doesn't work for me:

    echo '
    ' . var_dump($variable) . '
    ';

    This will not provide a nice display of the array for me, with line breaks (I'm using Firefox 31.3.0)

    However, after some experimentation, this solved the problem (notice the php is closed at first):

    ... ?> 

    This solves the problem and displays a nice, easy-to-read array for me on my browser. You see how the tags are not wrapped in PHP; only the echo var_dump part is.

提交回复
热议问题