简单的图形计数器(基于session)
以下的代码可以实现在php页面上插入图形计数器
<?php
//    这一部分要加到<html>标志的上方:
    
session_save_path("tmp");
    
session_start();
?>


<?
//以相代码插入需要显示计数器的地方。
    
$fd fopen("count.txt","r+");
    if(
$fd != 0)
    {

        
$readline=fgets($fd4096);
        if(!
session_is_registered("hello") )
        {
                
$hello 1;
                if(
session_register("hello") == false)
                    echo 
"注册变量失败";
                
$readline += 1;
                
fseek($fd0);
                
fputs($fd,$readlinestrlen($readline));
        }
        
fclose($fd);


        
$Length strlen($readline);
        
$imagePath "";
        for(
$i=1;$i<=6-$Length$i++)
            
$imgPath $imgPath."<img src ="."images\0.gif>";

        for(
$i=1;$i<=$Length$i++)
            
$imgPath $imgPath."<img src = "."images\".substr($readline,$i - 1,1).".gif>";
        echo $imgPath ;

    
};
?>

其中tmp路径要有读写权限。
0.gif,1.gif.......是数字的图片。如有需要者请e_mail:[email protected]
必复。