在这样的客户下载链接中,我不断得到key = 0:
处理可下载文件的代码:
$downloadables = array();
foreach ($product_manager_form_data['downloadable_files'] as $downloadable_files) {
if (!empty($downloadable_files['file'])) {
$downloadables[] = array(
'name' => wc_clean($downloadable_files['name']),
'file' => wp_unslash(trim($downloadable_files['file'])),
'previous_hash' => md5($downloadable_files['file']),
);
error_log( print_r( "Downloadables: {$downloadables}", true ) );
error_log(print_r(array_values($downloadables), true));
}
}
如果手动创建了产品,我会得到正确的密钥:
可能是什么问题?在哪里可以找到可下载文件的代码生成键?