以下代碼,我看到了一個WordPress主題。PHP - 它代表{}內的整個代碼
所有的代碼寫在{}
裏面。我不知道它是什麼,
這是什麼意思?
<?php
{
$html = '';
if ('right' === $sidebar_pos || 'left' === $sidebar_pos) {
$html = '<div class="';
if (is_active_sidebar('right-sidebar') || is_active_sidebar('left-sidebar')) {
$html .= 'col-md-8 content-area" id="primary">';
} else {
$html .= 'col-md-12 content-area" id="primary">';
}
echo $html; // WPCS: XSS OK.
} elseif (is_active_sidebar('right-sidebar') && is_active_sidebar('left-sidebar')) {
$html = '<div class="';
if ('both' === $sidebar_pos) {
$html .= 'col-md-6 content-area" id="primary">';
} else {
$html .= 'col-md-12 content-area" id="primary">';
}
echo $html; // WPCS: XSS OK.
} else {
echo '<div class="col-md-12 content-area" id="primary">';
}
}
這個標記是有效的,我不確定它真的意味着什麼特別。 – GrumpyCrouton
那裏有更多文件嗎?如果這是一個獨立的文件,我猜這是因爲該文件在主題的其他地方被調用。 – admcfajn