Странный файл записи размером 0кб - PullRequest
0 голосов
/ 28 июня 2019

У меня есть php-скрипт, который должен записывать файлы в определенные папки каждые 2 часа или около того, файлы, которые отличаются от времени (они казались случайными), были записаны, но «пустые» вес этих файлов составляет 0 кб

это странно, нет?

это сценарий

привет

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);
}
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...