我想知道在以下情况下哪个是更好的选择:
在PHP脚本中,如果$fileSize变量大于100,我停止脚本;
案例I:
<?php
if ( $fileSize > 100 )
{
$results['msg'] = 'fileSize is too big!';
echo json_encode( $results );
exit();
}
Run Code Online (Sandbox Code Playgroud)
案例二:
<?php
if ( $fileSize > 100 )
{
$results['msg'] = 'fileSize is too big!';
exit( json_encode( $results ) );
}
Run Code Online (Sandbox Code Playgroud)
案例III:
<?php
if ( $fileSize > 100 )
{
$results['msg'] = 'fileSize is too big!';
return( json_encode( $results ) );
}
Run Code Online (Sandbox Code Playgroud)
上面三(3)个选项中哪一个最好?