如果窗口大小是300x500然后打开页面,否则重定向PHP代码

I need some php code which has a defined window size, if size is true run the page if not redirect to another page. I will manage the window size using an iframe. Is it possible with php? If not is there another way.

this is a little javacript that checks the width and height then sets the document location if it isnt wht you specified, but it is being echoed from php. you can play with the maxheight, max width and url variables.

<?php 
 $jssnippet = "<script type='text/javascript'>var width = window.innerWidth; 
 var height= window.innerHeight; 
 var maxheight=480; 
 var maxwidth=360;
 var redirecturl='http://www.xl21.org';
 if((width>maxwidth) && (height>maxheight)){document.location=url; }</script>"; 

echo $jssnippet;
?>

PHP can't possibly know the window size.

This is a task for JavaScript.

Example of getting window size with JS