PHP:如何使用includes安全地设置页面上的活动链接

in an earlier post "PHP set active link on page using includes" there was a comment "That is waaaay too hackable". can you explain to me how it is hackable and how i can duplicate this idea with a safer method.

$page_id = $_REQUEST['page_id'];

 <ul>
          <li class="<?php echo ($page_id == "Home" ? "active" : "");?>">
 <a href="/">Home</a>
          </li>
          <li class="<?php echo ($page_id == "Apps" ? "active" : "");?>">
 <a href="#">Apps</a>
          </li>
          <li class="<?php echo ($page_id == "Forums" ? "active" : ""); ?>">
 <a href="#">Forums</a>
          </li>
        </ul>

I am building my first plugin for a website and i need to have links that php sets to active if you are on the page such as home or statistics. so the installation may be at www.website.com/home/plugin/statistics. I need to be able to set the class

statistics to active if they are on the page without knowing how many layers deep in their website my plugin is installed.

A better approach may be something like this:

In the page files (about.php, index.php, etc.) provide the unique identifier at the very top of the page:

<?php
$page_id = 'home';
require_once('_menu.php');

Separate your navigation into a file _menu.php to be included.

 <ul>
          <li class="<?php echo ($page_id == "Home" ? "active" : "");?>">
 <a href="/">Home</a>
          </li>
          <li class="<?php echo ($page_id == "Apps" ? "active" : "");?>">
 <a href="#">Apps</a>
          </li>
          <li class="<?php echo ($page_id == "Forums" ? "active" : ""); ?>">
 <a href="#">Forums</a>
          </li>
        </ul>