我有一些 php 代码。但是当我查看源代码时,它在开始时会输出一些空格。
有人可以帮我删除它吗?
这是屏幕截图
这是我的完整代码
<?php
include_once dirname(dirname(__FILE__)) . '/wp-load.php';
function dt_query() {
$args = array(
'post_type' => 'order_guide',
);
$the_query = new WP_Query( $args ); ?>
<?php $dt_array = array(); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php
$dt_array[] = array(
'glazier' => get_field('glazier'),
'brand' => get_field('brand'),
'pack' => get_field('pack'),
'size' => get_field('size'),
'description' => get_field('description'),
'code' => '<a href="'.get_field('code').'">Download</a>',
'cs_price' => get_field('cs_price'),
'split' => get_field('split'),
);
?>
<?php endwhile; ?>
<?php endif;
echo maybe_serialize($dt_array); ?>
<?php }
dt_query();