我有一个网站,可以将其命名为http://mysite.com/index.php
,这是我的主要网站,包含所有信息,我希望有另一个类似http://mysite.com/index.php?=premium
的网页,在此premium
页面中是全新的整页。这意味着不是相同的标题或与index.php页面有任何关系。
原因是我不希望我的访问者直接转到premium page
,因此他们必须首先访问index.php
页面,然后从那里点击。
这样可能吗?
@ knittl不确定我的问题是否已被清除
但实际上现在正在发生的事情是上面的代码可以让我很好地找到高级页面
但在高级页面中包含许多div类,我在高级页面中有这个
<?php
if(!isset($_GET['ch'])){
$ch = 1;
} else {
$ch = $_GET['ch'];
}
if ($ch == 1) {
echo "<div class='player_live_server_info'>
所以现在我发生了这件事
<li><a href="tv.php?page=premium?ch=1"><img src="live_img/ch_5.jpg"></a></li>
我不知道我是做对还是错,但它只是重定向回正常页面。
答案 0 :(得分:3)
<?php if(isset($_GET['page']) && $_GET['page'] == 'premium') {
// this is the premium version, only visible when called as index.php?page=premium
?>
<html>
<head><title>you are on the fancy premium page</title></head>
<body>
<h1>your premium page</h1>
</body>
</html>
<?php } else {
// this is the normal page with a link to the premium version
?>
<html>
<head><title>you are on the lame normal page</title></head>
<body>
<h1>your normal page</h1>
<p>
<a href="?page=premium">click here to go to our premium page</a>
</p>
</body>
</html>
<?php } ?>
答案 1 :(得分:0)
$ _ GET ['something']是你的最佳选择..你也可以使用$ _SESSION,但这会很复杂,加上你的应用程序会变慢。