我需要知道,我的php代码(应用程序)是否在iframe窗口或正常窗口运行?
请帮帮我
在PHP中不能,因为这只有客户端知道。
与javascript,
if (top === self) {
// not in any kind of frame
} else {
// in a frame
}
然后你可以通过重载跳出框架(或者向你的php应用程序报告一些东西,如果这是你想要的)
我不认为你可以这样做服务器端(php)。可以在客户端(javascript):
if (window.location.href != window.top.location.href)
{
// it is running inside a frame. Force it to run in the full window
window.top.location.replace(window.location.href);
}