try
{
$matrix = Query::take("SELECT moo"); //this makes 0 sense
while($row = mysqli_fetch_array($matrix, MYSQL_BOTH)) //and thus this line should be an error
{
}
return 'something';
}
catch(Exception $e)
{
return 'nothing';
}
काम नहीं कर रहा। मैं php में अपवादों का उपयोग करने के लिए कभी नहीं आया हूं, लेकिन उन्हें सी # में बहुत उपयोग किया जाता है और यह PHP में लगता है कि वे अलग-अलग काम कर रहे हैं या हमेशा के रूप में, मुझे कुछ स्पष्ट याद आ रहा है।पीएचपी कोशिश पकड़ सिर्फ भाग को पकड़ने के लिए जा रहा है और <code>nothing</code> लौटने यह लाइन <code>while</code> के साथ शुरू में एक चेतावनी <code>Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given</code> से पता चलता की हालांकि बजाय
यहां कुछ प्रश्न हैं: http://stackoverflow.com/questions/1241728/can-i-try-catch-a-warning –
डुप्लिकेट: http://stackoverflow.com/questions/1241728/can- i-try-catch-a-चेतावनी – wesside
इसे पढ़ें http://phpmaster.com/error-handling-in-php/ – vascowhite