简体   繁体   English

PHP - 突破框架

[英]PHP - Break out of a frame

Is there a way to break out of a frame using PHP? 有没有办法使用PHP突破框架? I have done it with JavaScript, but I would really prefer to use PHP instead. 我用JavaScript做过,但我更喜欢用PHP代替。 Thank you. 谢谢。

Frames are a client-side issue. 框架是客户端问题。 Javascript is the solution, because it is a client-side scripting language that has awareness of the browsing context. Javascript是解决方案,因为它是一种客户端脚本语言,可以识别浏览上下文。 Frames are meaningless on the server-side. 框架在服务器端是没有意义的。

So, only client-side code can do this. 因此,只有客户端代码才能执行此操作。 Not PHP. 不是PHP。

PHP is server-side. PHP是服务器端的。 It merely generates the HTML for a page. 它只是为页面生成HTML。 As such there is no way for it to determine whether its output is being shown in a frame. 因此,它无法确定其输出是否在帧中显示。

The best PHP can do for you is outputting the Javascript code to break out of a frame. 最好的PHP可以为您输出Javascript代码以突破框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM