|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
本教程属于原创,转载请注明网页教学网 今天给大家做出了一个能显示浏览者的屏幕分辨率的PHP代码,希望大家使用 一下,有什么问题请到论坛发帖讨论。 首先新建一个文件取名为:resolution.php代码的内容如下:(注重:文件的扩展名必须是.PHP不要是.HTML) <script language="javascript"> <!-- function writeCookie() { var today = new Date(); var the_date = new Date("December 31, 2023"); var the_cookie_date = the_date.toGMTString(); var the_cookie = "users_res="+ screen.width +"x"+ screen.height; var the_cookie = the_cookie + ";expires=" + the_cookie_date; document.cookie=the_cookie location = \\'\\'; } function checkRes(width, height) { if(width != screen.width || height != screen.height) { writeCookie(); } else { return true; } } //--> </script> <script language="javascript"> <!-- checkRes(1024, 768); //--> </script> //网页教学网http://www.webjx.com 网页设计师的摇篮!! 其次把下面的代码放到你想在哪显示访客的显示器分辨率信息的地方就可以了!( 下面代码当然也是放在扩展名为.PHP的文件中) <?php $callget_res_page_name = $REQUEST_URI; $GLOBALS[callget_res_page_name ] = $callget_res_page_name; include("resolution.php"); echo $screen_width."x".$screen_height." is your screen resolution."; ?> 注重:$应该是半角。 返回类别: 教程 上一教程: 一个简朴的自动发送邮件系统(二) 下一教程: PHP实现分页的一个示例 您可以阅读与"用PHP程序来显示浏览者的显示器分辨率"相关的教程: · 用定制的PHP应用程序来获取Web服务器的状态信息 · PHP 留言簿(带Oracle数据库分页的显示功能) · 为什么有时PHP程序会在开头显示:X-Powered-By: PHP/4.0.0之类的字符呢? · PHP中显示格式化的用户输入 · 用Pear加速PHP程序开发 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |