我正在尝试查看 URL 中是否有“类别”值,获取该值并将其添加到 href,但我得到的是,例如,“4”添加到了 href,而不是“&category=4”,这就是我所追求的。谁能看到我做错了什么?
// if so, add it to the query
if ($cat_ID) {
$cat_string = "&category=" + $cat_ID;
} else {
$cat_string = "";
}
?>
<li><a href="?page_id=60&orderby=rand<?php echo $cat_string; ?>">Random</a></li>
<li><a href="?page_id=60&orderby=title&order=ASC<?php echo $cat_string; ?>">Title Asc.</a></li>
<li><a href="?page_id=60&orderby=title&order=DESC<?php echo $cat_string; ?>">Title Desc.</a></li>
<li><a href="?page_id=60&orderby=date&order=ASC<?php echo $cat_string; ?>">Date Uploaded Asc.</a></li>
<li><a href="?page_id=60&orderby=date&order=DESC<?php echo $cat_string; ?>">Date Uploaded Desc.</a></li>
</ul>