您的位置:首页 > 编程语言 > PHP开发

自己写的debug类 实现变更输出

2009-07-17 01:13 176 查看
<?php

class debug {

/**
* 在settings.yml中添加如下内容:
* all:
* .settings:
* debug: on
*/

function __construct() {

//TODO - Insert your code here
}

/**
*
*/
function __destruct() {

//TODO - Insert your code here
}
//获取调试开关
public function get_debug_sitting() {
$config=new sfConfig();
if ($config->get('sf_debug')) {
return true;
}else {
return false;
}
}
//输出调试信息
//用来输出变量的信息
public function debug_print($var,$file=__FILE__,$line=__LINE__) {
if ($this->get_debug_sitting()) {
$where = "File= $file($line)";
switch (strtolower(substr(php_sapi_name(),0,3))) {
case 'cli':
echo "$where";
var_dump($var);
break;
default:
echo "$where";
print("<pre>");
var_dump($var);
print("</pre>");
break;
}

}
}

}

?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php zend 休闲 debug symfony
相关文章推荐