SarkariResultess QA Bank

PHP exception handling का basic syntax क्या है? को secure तरीके से कैसे implement करें?

Other 0 Views Verified
PHP exception handling का basic syntax क्या है? को secure तरीके से कैसे implement करें? सही विकल्प चुनें और code/solution को समझें।
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified

try risky() except $e

try risky() except $e
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified

handle risky with error()

handle risky with error()
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified

catch around try only

catch around try only
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified Correct Answer

try { risky(); } catch (Throwable $e) { log_error($e); }

try { risky(); } catch (Throwable $e) { log_error($e); }
Additional Explanation
try/catch exceptions और Throwable errors handle कर सकता है। User input को trust न करें; validation, escaping और prepared statements context के अनुसार उपयोग करें।