Home >Backend Development >PHP Tutorial >PHP top-level classes_PHP tutorial
/**
* Object
* base class
*/
class Object
{
/* Whether to output debugging information */
var $debug = true;
/**
*Object
* @deprecated destructor method
*
* @return void
*/
function Object()
{
//Determine whether the user enters from the homepage
if ( !defined( 'INDEX' ) )
{
die( "Hacking attempt" );
}
//echo 'create Object success!';
}
/**
* msg_die
* @deprecated debug information output
* @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 . ";
printf( $format , $info , $file , $line );
$error = debug_backtrace();
print_r ( $error[0] );
}
}
/**
* setDebug
* @deprecated Set whether to output debugging information
* @param boolean true or false
* @return void
*/
function setDebug( $bool )
{
$this->debug = is_bool( $bool ) ? $bool : false ;
}
/**
* getDebug * @deprecated Check whether debugging information is turned on
* @param void
* @return boolean
*/
function getDebug()
{
return $this->debug;
}
}
?>