![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
[php]<?php
class Memory_Control{
var $shm_id="";
var $shm_key=0xfb3;
var $shm_mode="c";
var $shm_purview=0644;
var $shm_size=100;
var $shm_str="";
//构造函数
function Memory_Control($shm_key=0xfb3,$shm_mode="c",$shm_purview=0644,$shm_size=0){
$this->shm_key=$shm_key;
$this->shm_mode=$shm_mode;
$this->shm_purview=$shm_purview;
$this->shm_size=$shm_size;
$this->shm_id=shmop_open($this->shm_key, $this->shm_mode, $this->shm_purview, $this->shm_size);
$this->shm_size=shmop_size($this->shm_id);
}
//读取函数
function Memory_Read($start=0,$count=""){
if($count=="")
$count=$this->shm_size;
$this->shm_str=shmop_read($this->shm_id, $start, $count);
return $this->shm_str;
}
//写入函数
function Memory_Write($writ_str,$start=0){
$len=shmop_write($this->shm_id, $writ_str, $start);
return $len;
}
//删除函数
function Memory_Delete(){
shmop_delete($this->shm_id);
}
function Memory_Close(){
shmop_close($this->shm_id);
}
}
$memoryop=new Memory_Control(0xff3,"c",0644,0);
$str=$memoryop->Memory_Read();
echo $str;
$str=intval($str);
$str=$str+1;
$memoryop->Memory_Write($str,0);
$memoryop->Memory_Delete();
$memoryop->Memory_Close();
?>[/php]
为什么执行了$memoryop->Memory_Delete();以后内存里的值没有被释放呢?

