gpt4 book ai didi

Drupal 7 批处理页面示例

转载 作者:行者123 更新时间:2023-12-01 02:30:41 24 4
gpt4 key购买 nike

我正在尝试设置一个批处理页面进行处理,我需要一个示例。示例模块中给出的示例在一个表单中,我需要一个可以独立于处理批处理请求的表单运行的页面。

例如:

function mymodule_batch_2() {
$operations[] = array('mymodule_onefunction','mymodule_anotherfunction')
$batch = array(
'operations' => $operations,
'finished' => 'mymodule_finished',
// We can define custom messages instead of the default ones.
'title' => t('Processing batch 2'),
'init_message' => t('Batch 2 is starting.'),
'progress_message' => t('Processed @current out of @total.'),
'error_message' => t('Batch 2 has encountered an error.'),
);
batch_set($batch);
batch_process('');
}

批处理函数将以 $operations 的形式调用其他函数。

最佳答案

你需要给批处理一个 id 来工作。 batch_process('mybatch') 否则 yourmexample 是正确的。你对这个策略有什么特别的问题吗?

关于Drupal 7 批处理页面示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13148872/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com