Drupal進度條

來源:互聯網
上載者:User

簡介:這是Drupal進度條的詳細頁面,介紹了和php,有關的知識、技巧、經驗,和一些php源碼等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=340018' scrolling='no'>

Drupal有一個內建的百分比進度條顯示操作進度的工具batch.

使用方式如下:

batch_set(batch_example_batch_1());

batch_process('redirect_page.php');

function batch_example_batch_1() {

    for ($i = 0; $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);

愛J2EE關注Java邁克爾傑克遜視頻站JSON線上工具

http://biancheng.dnbcw.info/php/340018.html pageNo:7

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.