在格式良好的可扩展div列表中打印大数组
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在格式良好的可扩展div列表中打印大数组相关的知识,希望对你有一定的参考价值。
I use this primarily for debugging purposes. This simply takes an array and creates an expandable item that prints the array out in a wrapping, making it easy to read. Very basic snippet.
<html> <head> <script type="text/javascript"> $(document).ready(function() { $(".exp_body").hide(); $(".exp_head").click(function() { $(this).next(".exp_body").slideToggle(400); $(this).toggleClass('exp_head_expanded'); // <-- This changes the element's class when clicked. use it with CSS to create a "plus/minus" expand style. }); }); </script> <style> .expand { margin: 0px; padding: 0px; width: 750px; } .exp_head { padding: 5px 10px 5px 35px; cursor: pointer; color: #41270E; position: relative; background: #779DA7 url('../images/plus.png') no-repeat 10px; margin: 1px; } .exp_head_expanded { background: #779DA7 url('../images/minus.png') no-repeat 10px; } .exp_body { padding: 5px 10px 15px; background-color: #F4F4F8; color: #8D633A; word-wrap: break-word; } </style> </head> <body> <?php function print_array($array, $title) { echo "<p class='exp_head'>$$title</p> "; echo "<div class='exp_body'> "; echo " <pre> "; echo " </pre> "; echo "</div> "; } echo "<div class='expand'>"; # -- Any arrays can be added below to be placed in the same list print_array($_SERVER,'_SERVER'); print_array($x,'x'); print_array($y,'y'); echo "</div>"; ?> </body> </html>
以上是关于在格式良好的可扩展div列表中打印大数组的主要内容,如果未能解决你的问题,请参考以下文章