आप बस PHP के मानक समय समाप्ति इस्तेमाल कर सकते हैं, और एक shutdown समारोह को लागू।
function say_goodbye() {
if (connection_status() == CONNECTION_TIMEOUT) {
... do your special processing to save the process state here
... then formulate a response for the browser
}
} // function say_goodbye()
register_shutdown_function("say_goodbye");
ध्यान दें कि आप मापदंडों
संपादित
function say_goodbye($controller1,$controller2) {
if (connection_status() == CONNECTION_TIMEOUT) {
... do your special processing to save the process state here
... then formulate a response for the browser
}
} // function say_goodbye()
$ctl1 = new DBController();
$ctl2 = new OPController();
register_shutdown_function("say_goodbye",$ctl1,$ctl2);
स्रोत
2011-01-25 17:23:50
+1 मैंने वही जवाब दिया होगा। – Christian
उत्तर के लिए धन्यवाद, लेकिन एक ढांचे के भीतर लागू करना सरल नहीं है। इसके अलावा, यह सटीक नहीं है क्योंकि ढांचे द्वारा उपयोग किए जाने वाले प्रसंस्करण समय को – jmint
नहीं माना जाता है, मुझे उम्मीद है कि आपको एक वास्तविक समय की आवश्यकता होगी, न कि समय-समय पर 'फ्रेमवर्क समय'। जहां तक इसे मौजूदा कोड में कार्यान्वित किया जाता है, टाइमर वैश्विक रूप से सुलभ होने के लिए, सबसे आसान (आवश्यक नहीं है) एक सिंगलटन का उपयोग कर सकता है। – Mchl