奇怪的写入文件大小0kb

时间:2019-06-28 07:48:39

标签: php wordpress

我有一个php脚本,必须每2小时在某些文件夹中写入一个文件,以便写入与时间不同的文件(它们似乎是随机的),但是“空”的这些文件的权重为0 kb

很奇怪,不是吗?

是脚本

致谢

add_action('pmxe_after_export', 'wpae_get_file_after_export', 10, 2);
function wpae_get_file_after_export($export_id, $exportObj){

$is_secure_export = PMXE_Plugin::getInstance()->getOption('secure');

if (!$is_secure_export) {
$filepath = get_attached_file($exportObj->attch_id);
} else {
$filepath = wp_all_export_get_absolute_path($exportObj->options['filepath']);
}

if ( $export_id == '1') {
$nomefile = 'Testata_Ordine';
}

if ( $export_id == '2') {
$nomefile = 'Riga_Ordine';
}

if ( $export_id == '3') {
$nomefile = 'Cliente';
}

if ( $export_id == '4') {
$nomefile = 'DestinazioneFATT';
}

if ( $export_id == '5') {
$nomefile = 'Destinazione';
}
$indirizzo_intero = $_SERVER['DOCUMENT_ROOT']."/_in_out/_out/";
$nuovo_nome = $indirizzo_intero.$nomefile.".txt";
rename( $filepath, $nuovo_nome);

if ( $export_id == '5') {
$DestFile = $indirizzo_intero."Destinazione.txt";
$FattFile = $indirizzo_intero."DestinazioneFATT.txt";
$ContFile = file_get_contents($DestFile);
$ContFile .= file_get_contents($FattFile);
$ContFile = str_replace(array('|','"'), array(' ',''), $ContFile);
file_put_contents($DestFile, $ContFile);
unlink($FattFile);
} else {
$contenuto_file = file_get_contents($nuovo_nome);
$contenuto_file = str_replace(array('|','"'), array(' ',''), $contenuto_file);
file_put_contents($nuovo_nome, $contenuto_file);
}
}

0 个答案:

没有答案