I would like to know in the following case which is a better option:
In the PHP script, if the $fileSize
variable is larger than 100, I stop the script;
Case I:
<?php
if ( $fileSize > 100 )
{
$results['msg'] = 'fileSize is too big!';
echo json_encode( $results );
exit();
}
Case II:
<?php
if ( $fileSize > 100 )
{
$results['msg'] = 'fileSize is too big!';
exit( json_encode( $results ) );
}
Case III:
<?php
if ( $fileSize > 100 )
{
$results['msg'] = 'fileSize is too big!';
return( json_encode( $results ) );
}
Which of the three (3) options above is the best?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…