易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP 中长连接的实现

  每次我们访问 PHP 脚本的时候,都是当所有的PHP脚本执行完成后,我们才得到返回结果。如果我们需要一个脚本持续的运行,那么我们就要通过 PHP 长连接的方式,来达到运行目的。
  每个 PHP 脚本都限制了执行时间,所以我们需要通过 set_time_limit 来设置一个脚本的执行时间为无限长;然后使用 flush() 和 ob_flush() 来清除服务器缓冲区,随时输出脚本的返回值。
  如下面这段脚本:
<?php
header("Content-Type: text/plain");
set_time_limit(0);
$infoString = "Hello World" . "\n";
while( isset($infoString) )
{
echo $infoString;
flush();
ob_flush();
sleep(5);
}
?>
  当我们执行后,每隔 5 秒钟,我们会得到一行 Hello World ,如果不按停止按钮,浏览器会不停的一行一行继续加载。
  通过这一方法,我们可以完成很多功能,例如机器人爬虫、即时留言板等程序。


相关文档:

PHP调用系统命令修改IP,netmask,gateway,mac,dns

ip_contrl.php:
<?php
 //include('header.php');
 
 $ipaddr = $_POST['ipaddr'];
 $netmask = $_POST['netmask'];
 $gateway = $_POST['gateway'];
 $mac = $_POST['mac'];
 $dns1 = $_POST['dns1'];
 $dns2 = $_POST['dns2'];
 //echo "ipaddr=$ipaddr;netm ......

PHP: How to Get the Current Page URL

Sometimes, you might want to get the current page URL that is shown
in the browser URL window. For example if you want to let your visitors
submit a blog post to Digg you need to get that same exact URL. There
are plenty of other reasons as well. Here is how you can do that.
Add the followin ......

php中iconv函数使用方法(转)


iconv函数库能够完成各种字符集间的转换,是php编程中不可缺少的基础函数库。 
1、下载libiconv函数库http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz; 
2、解压缩tar -zxvf libiconv-1.9.2.tar.gz; 
3、安装libiconv 
#configure --prefix=/usr/local/iconv 
#make 
......

PHP htmlspecialchars() 函数


定义和用法
htmlspecialchars() 函数把一些预定义的字符转换为 HTML 实体。
预定义的字符是:
& (和号) 成为 &amp;
" (双引号) 成为 &quot;
' (单引号) 成为 &#039;
< (小于) 成为 &lt;
> (大于) 成为 &gt;
语法
htmlspecialchars(string,quotestyle,character-se ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号