WC_CSV_Exporter::fputcsv()
Write to the CSV file, ensuring escaping works across versions of PHP.
PHP 5.5.4 uses '\' as the default escape character. This is not RFC-4180 compliant. \0 disables the escape character.
Метод класса: WC_CSV_Exporter{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->fputcsv( $buffer, $export_row );
- $buffer(resource) (обязательный)
- Resource we are writing to.
- $export_row(массив) (обязательный)
- Row to export.
Заметки
- Смотрите: https://bugs.php.net/bug.php?id=43225
- Смотрите: https://bugs.php.net/bug.php?id=50686
- Смотрите: https://github.com/woocommerce/woocommerce/issues/19514
- Смотрите: https://github.com/woocommerce/woocommerce/issues/24579
Список изменений
С версии 3.9.0 | Введена. |
Код WC_CSV_Exporter::fputcsv() WC CSV Exporter::fputcsv WC 7.3.0
protected function fputcsv( $buffer, $export_row ) { if ( version_compare( PHP_VERSION, '5.5.4', '<' ) ) { ob_start(); $temp = fopen( 'php://output', 'w' ); // @codingStandardsIgnoreLine fputcsv( $temp, $export_row, $this->get_delimiter(), '"' ); // @codingStandardsIgnoreLine fclose( $temp ); // @codingStandardsIgnoreLine $row = ob_get_clean(); $row = str_replace( '\\"', '\\""', $row ); fwrite( $buffer, $row ); // @codingStandardsIgnoreLine } else { fputcsv( $buffer, $export_row, $this->get_delimiter(), '"', "\0" ); // @codingStandardsIgnoreLine } }