Going an extra step on the comment above from @El_Vanja:
Figure out the current url with the following code:
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
Then add that condition when you're forming the link:
<li<?php if($home_url == $actual_link echo ' class="active"';?>><a class="dropdown-item" href="<?php echo $home_url .
$cat_id."/".strtolower($name_under);?>.html">
<?php echo strtoupper($name_cat); ?></a></li>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…