Home >Backend Development >PHP Tutorial >PHP top-level classes_PHP tutorial

PHP top-level classes_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:58:59824browse

/**
* 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;
}
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631974.htmlTechArticle?php /*** Object * base class*/ class Object { /* Whether to output debugging information*/ var $debug = true; /*** Object * @deprecated destructor method * * @return void*/ function Object() { /...
Statement:
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