2019独角兽企业重金招聘Python工程师标准>>>
在开发的过程中,我们经常要输出一下变量看看得到的结果是什么,我们就要根据变量的类型选择使用echo,print_r或者var_dump,brophp框架中的p()函数会自动根据变量类型选择用什么方法为我们输出变量,所以我收藏了


function p() {$args=func_get_args(); //获取多个参数if(count($args)<1){echo '<font color="red">必须为p()函数提供参数!</font>';return;} echo '<div style="width:100%;text-align:left"><pre>';//多个参数循环输出foreach($args as $arg){if(is_array($arg)){print_r($arg);echo '<br>';}else if(is_string($arg)){echo $arg.'<br>';}else{var_dump($arg);echo '<br>';}}echo '</pre></div>';}
是不是很实用啊!如果你是一位程序员 那么就收藏吧
转载:http://www.chengdeshixinxi.com/html/2014/remould_0102/4.html