Please do not pirated, reproduced please add source http://blog.csdn.net/yanlintao1
First, let me explain my problems.
Try {
// Import Student Information
$ ModelStudent-> insert ($ data2 );
} Catch (Exception $ e ){
Unlink (DOCS_PATH. '/student.xls ');
$ This-> view-> str = 'import failed. Check whether the data grid is correct! ';
$ This-> _ forward ("error", "global ");
}
// Jump back to the import page
$ This-> render ("import ");
I found that when the second jump action appears under try catch, the catch content in try catch will not be able to see the execution effect, which is equivalent to not being executed.
Solution: place the second jump action in try.
Try {
// Import Student Information
$ ModelStudent-> insert ($ data2 );
// Jump back to the import page
$ This-> render ("import ");
} Catch (Exception $ e ){
Unlink (DOCS_PATH. '/student.xls ');
$ This-> view-> str = 'import failed. Check whether the data grid is correct! ';
$ This-> _ forward ("error", "global ");
}