Introduction: This is a detailed page of The Drupal progress bar. It introduces the knowledge, skills, experience, and some PHP Source Code related to PhP.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 340018 'rolling = 'no'>
Drupal has a built-in batch tool with a percentage progress bar showing the operation progress.
The usage is as follows:
Batch_set (batch_example_batch_1 ());
Batch_process ('redirect _ page. php ');
Function batch_example_batch_1 (){
For ($ I = 0; I I <100; $ I ++ ){
$ Operations [] = array ('batch _ example_op_1 ', array ($ NID ));
}
$ Batch = array (
'Operations' => $ operations,
'Finished' => 'batch _ example_finished ',
);
Return $ batch;
}
Function batch_example_op_1 ($ NID, & $ context ){
Do_something ();
// Store some result for post-processing in the finished callback.
$ Context ['results'] [] = "do something ";
// Optional message displayed under the progressbar.
$ Context ['message'] = T ('loading @ title', array ('@ title' => $ node-> title ));
}
Function batch_example_finished ($ success, $ results, $ operations ){
If ($ success ){
$ Message = count ($ Results). 'processed .';
}
Else {
$ Error_operation = reset ($ operations );
$ Message = 'an error occurred while processing '. $ error_operation [0].' with arguments: '. print_r ($ error_operation [0], true );
}
Drupal_set_message ($ message );
}
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/340018.html pageno: 7.