I am trying to email myself the client's browser data once; however, the page the require_onc开发者_C百科e is on has a jQuery gallery changing images and it seems... that the php is running with every image transition.
I tried to prevent the repeat with this, but that too fails
$currentFile = $_SERVER["SCRIPT_NAME"];
if ($execute <> 5) { require_once 'send_mail.inc'; }
Where $execute is set to 5 in send_mail.inc.
Ideas?
require_once is per runtime. If you have a bunch of ajax requests, each is filled by a new runtime. You need a way to persist something. You could use sessions to do that. Store a fact about the first request in session and send the email. On subsequent requests, do not send the email.
精彩评论