shmop建立共享内存后,怎么也不能清空,我试验了两种方法都不行
一种测试方法是:
$intKey=1234;
$intLength=12;
$strValue1="abcdefg";
$strValue2="33";$intShmopId=shmop_open($intKey,"c",0666,$intLength) ;
shmop_write($intShmopId,$strValue1,0);
shmop_delete($intShmopId);
shmop_close($intShmopId);$intShmopId=shmop_open($intKey,"w",0666,$intLength) ;
shmop_write($intShmopId,$strValue2,0);
$strResult=shmop_read($intShmopId,0,$intLength);
shmop_close($intShmopId);
echo $strResult;//这里的输出结果是333456第二种方法:
$intKey=1234555;
$intLength=12;
$strValue1="abcdefg";
$strValue2="33";$intShmopId=shmop_open($intKey,"c",0666,$intLength) ;
for($i=0;$i<$intLength;$i++)
{
shmop_write($intShmopId,"",$i);
}
shmop_close($intShmopId);$intShmopId=shmop_open($intKey,"w",0666,$intLength) ;
shmop_write($intShmopId,$strValue2,0);
$strResult=shmop_read($intShmopId,0,$intLength);
shmop_close($intShmopId);
echo $strResult;//这里的输出结果还是是333456请问这是怎么回事?
一种测试方法是:
$intKey=1234;
$intLength=12;
$strValue1="abcdefg";
$strValue2="33";$intShmopId=shmop_open($intKey,"c",0666,$intLength) ;
shmop_write($intShmopId,$strValue1,0);
shmop_delete($intShmopId);
shmop_close($intShmopId);$intShmopId=shmop_open($intKey,"w",0666,$intLength) ;
shmop_write($intShmopId,$strValue2,0);
$strResult=shmop_read($intShmopId,0,$intLength);
shmop_close($intShmopId);
echo $strResult;//这里的输出结果是333456第二种方法:
$intKey=1234555;
$intLength=12;
$strValue1="abcdefg";
$strValue2="33";$intShmopId=shmop_open($intKey,"c",0666,$intLength) ;
for($i=0;$i<$intLength;$i++)
{
shmop_write($intShmopId,"",$i);
}
shmop_close($intShmopId);$intShmopId=shmop_open($intKey,"w",0666,$intLength) ;
shmop_write($intShmopId,$strValue2,0);
$strResult=shmop_read($intShmopId,0,$intLength);
shmop_close($intShmopId);
echo $strResult;//这里的输出结果还是是333456请问这是怎么回事?
一种测试方法是:
$intKey=1234;
$intLength=12;
$strValue1="abcdefg";
$strValue2="33"; $intShmopId=shmop_open($intKey,"c",0666,$intLength) ;
shmop_write($intShmopId,$strValue1,0);
shmop_delete($intShmopId);
shmop_close($intShmopId); $intShmopId=shmop_open($intKey,"w",0666,$intLength) ;
shmop_write($intShmopId,$strValue2,0);
$strResult=shmop_read($intShmopId,0,$intLength);
shmop_close($intShmopId);
echo $strResult;//输出的结果都是33cdefg第二种方法:
$intKey=1234555;
$intLength=12;
$strValue1="abcdefg";
$strValue2="33"; $intShmopId=shmop_open($intKey,"c",0666,$intLength) ;
for($i=0;$i <$intLength;$i++)
{
shmop_write($intShmopId,"",$i); }
shmop_close($intShmopId); $intShmopId=shmop_open($intKey,"w",0666,$intLength) ;
shmop_write($intShmopId,$strValue2,0);
$strResult=shmop_read($intShmopId,0,$intLength);
shmop_close($intShmopId);
echo $strResult;//这里的输出结果还是33cdefg请问这是怎么回事?4楼说的也我也看了,但是还是不能最终解决问题,多次试验表明,在WINDOWS2003、WINDOWS XP系统下,shmop_delete清空不了内存块,但是我用循环的方法调用shmop_write(见方法二),向内存中写入空值,也写不进去,真是无能为力了。
你的php什么版本
给分了。