RE: [PHP] Avoid object twice

From: Date: Wed, 04 Jun 2008 15:13:42 +0000
Subject: RE: [PHP] Avoid object twice
Groups: php.general 
Request: Send a blank email to php-general+get-275008@lists.php.net to get a copy of this message
On 04 June 2008 16:03, Yui Hiroaki advised: > NO! > That is what I do not want! > setting.php need to run mail() function. > also setting.php need $googlemapkey. > > other.php just need $googlemapkey. > other .php do not need run mail() function. > > If I use "include", I will get twice email. Same answer as Thijs gave, just with the filenames moved around: google_info.php <?php $googlemapkey = "g8ejeUFEUHEU";// example function sendMail() { mail("test@example.com","test"."test"); } ?> setting.php <?php include "google_info.php"; sendMail(); // sends mail // other stuff using your google API key ?> other.php <?php include "google_info.php"; // use your google API key any way you want // ... but no call to sendMail() ?> Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

« previous php.general (#275008) next »