shmop 问题
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
请问这是怎么回事?