1

我正在制作一个具有一个 index.php 文件的应用程序。我还有这些其他页面:

contact_form_homepage.php 
contact_form_config.php 
contact_form_doc.php 
contact_form_stats.php 
contact_form_premium.php 

我正在寻找一种方法,我可以将所有页面链接到 index.php,这样每当用户点击 Home 时,它​​就会将他带到 contact_form_homepage.php,而每当他点击 Config 时,就会将他带到 contact_form_config.php 等等。

IE

<a href="http://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_config&amp;tab=contact_form_config&amp;page_id=" title="contact_form_config" class="fbtab">Configuration</a>

我应该使用哪种 php 魔法?请帮助

4

3 回答 3

0

我通常的技术是包含一个 php 模块。我通常把我的放在 site/ action.php

您可以在我的框架中的标准 index.php的第 105 行看到这一点。

// get the action
$ac=get_from_get('p');
$ua = "";
$is_mvc = 0;

// if no action specified this is the default action.
if ($ac=="")
    $ac="login";

// attempt include the PHP for the action
$file = "site/$ac.php";
if (file_exists($file))
    include($file);
else
{
    header("HTTP/1.0 404 Not Found");
    exit;
}
于 2012-07-03T12:05:01.130 回答
0

只需像上面所说的那样做一个链接......

<a href="http://apps.facebook.com/mtkenya-dev/index.php?p=contact_form_config&amp;tab=contact_form_config&amp;page_id=2" title="contact_form_config" class="fbtab">Configuration</a>

然后你可以读取php代码中的page_id变量......

if($_GET['page_id'] == 2) {
header("Location: contact_form_config.php");
}
于 2012-07-03T12:07:37.633 回答
0

您可以做一件事,根据“p=contact_form_config”之类的查询字符串参数,您可以在 index.php 文件中加载适当的页面。

dg 当查询字符串参数为 p=contact_form_config 时,您可以使用以下代码

if($_GET['p'] == "contact_form_config ")
{
    // you can load your page now
    include_once('contact_form_config.php');
}

希望这会有所帮助:)

于 2012-07-03T12:09:16.840 回答