Re: Class Load twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 31, 2008, at 211AM, Yui Hiroaki wrote:
I just do not want to load mail() when load.php is load.
if you know how to solove it, please teach me it!

*********MyClass.php***********
<?php
$objRef=new MyClass("hui7gutWSFrh6zt");
$objRef->buff();
mail("aaa@xxxxxxxxxxx","test","test");
class MyClass{
	 Private $google;
	 function __construct($googleKEY){
		$this->google=$googleKEY;

	}
	public function buff(){
		echo $this->google;
	}
}

?>

Because the call to the mail function is outside of the class definition, it will be executed as soon as the file is included. If you want the email to be sent by the class, it needs to be done within one of the class methods (functions).

Brady

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux