Home > Backend Development > PHP Tutorial > php 顶层类(自家用)_PHP

php 顶层类(自家用)_PHP

WBOY
Release: 2016-06-01 12:32:02
Original
1017 people have browsed it

/**
* Object
* base class
* @version 1.0.0 (Mon Aug 01 18:43:24 CST 2005)
* @author sanshi
*/
class Object
{
/* 是否输出调试信息 */
var $debug = true;

/**
* Object
* @version 1.0.0 (Mon Aug 01 18:49:48 CST 2005)
* @author sanshi
* @deprecated 析构方法
*
* @return void
*/
function Object()
{
//用户是否从主页进入,做判断
if ( !defined( 'INDEX' ) )
{
die( "Hacking attempt" );
}
//echo 'create Object success!';
}

/**
* msg_die
* @version 1.0.0 (Mon Aug 01 18:52:43 CST 2005)
* @author sanshi
* @deprecated 调试信息输出
* @param string
* @return void
*/
function msg_die( $info , $file , $line )
{
if( $this->debug )
{
$format = "There is happen error information: %s .".
" the file name: %s , on line : %s .\n";
printf( $format , $info , $file , $line );
$error = debug_backtrace();
print_r ( $error[0] );
}
}

/**
* setDebug
* @version 1.0.0 (Mon Aug 01 18:56:45 CST 2005)
* @author sanshi
* @deprecated 设置是否输出调试信息
* @param boolean true or false
* @return void
*/
function setDebug( $bool )
{
$this->debug = is_bool( $bool ) ? $bool : false ;
}

/**
* getDebug
* @version 1.0.0 (Mon Aug 01 19:01:22 CST 2005)
* @author sanshi
* @deprecated 查看是否打开调试信息
* @param void
* @return boolean
*/
function getDebug()
{
return $this->debug;
}
}
?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template