0

so i have a code like this:

if ($var == null || 'NULL'){
echo "<h1>something</h1>";
echo "<div id='footer'><b>something</b><br/><br/><br/></div>";
echo "<b>something</b>";}
    else {}

so, on my main page the value var == null and that's great because i want those linse to be displayed in that page, but if i have an iframe somewhere else and i want to set this variable to 1 like $var = 1 so it doesn't show in the iframe but instead will show on the main page because there the value is null, how can i do this?

4

1 回答 1

4

您无法在服务器端检测到 iframe,但您可以iframe在页面上嵌入 iframe 时向脚本传递一个附加参数:

<iframe src="script.php?iframe=1"></iframe>

然后检查 的值$_GET['iframe']

于 2012-09-26T13:23:52.193 回答