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

php的static变量作用域

对于运行在apache里的php应用来说,static变量的作用域是一次http请求。
可以通过以下代码进行验证:
<?php
# test.php
function test(){
     static $sss = 0;
     ++$sss;
     echo $sss;
}
test();
?>
访问/test.php ,可以看到,总是echo出1。
ps:生命域还有,一个http线程周期,这种全局变量需要在php扩展中声明。


相关文档:

Linux下C++实现PHP扩展中级应用(一)


此篇文章准备分2个部分来讲述:
    第一部分主要详细讲述一下怎么构建一个完成的C++应用扩展模块;
   
第二部分主要讲述在PHP及Zend框架下怎么使用Zend API和C++语言来实现自己所要的功能以及项目的开发;
    此篇文章所运用的环境在Linux
2.4.21-4.ELsmp(Red Ha ......

php删除文件和整个文件夹

function delfile($dir)
{
if (is_dir($dir))
{
$dh=opendir($dir);
while (false !== ( $file = readdir ($dh)))
{
if($file!="." && $file!="..")
{
$fullpath=$dir."/".$file;
if(!is_dir($fullpath))
{
unlink($fullpath);
} ......

php动态生成表格的合并

<?php
$link=mysql_connect("localhost","root","root");
$db=mysql_select_db("bustest",$link);
$sql1="select name from info group by name order by id asc";
print("<table border='1'>");
$res1=mysql_query($sql1);
while($row1=mysql_fetch_array($res1)){
$name=$row1["name"];
$sql2="select i ......

PHP中的stristr(),strstr(),strpos()速度比较


PHP中的stristr(),strstr(),strpos()速度比较

测速代码:

<?php
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
......

php无限分类的类

<?php
/**
 by lenush;
 */
class Tree
{
    var $data    = array();
    var $child    = array(-1=>array());
    var $layer    = array(-1=>-1);
    var $parent &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号