请教内存共享的问题!!!
代码如下:
<br /><?php<br /><br />$sysid = $shmkey = ftok(__FILE__, 't');<br />$flags = "c";<br />$mode = 0766;<br />$size = 1024;<br /><br />$shmid = shmop_open($sysid, $flags, $mode, $size);<br />shmop_write($shmid, "Hello", 0);<br />$len = shmop_size($shmid);<br />$cont = shmop_read($sysid, 0, "Hello");<br />var_dump($cont);<br />shmop_delete($shmid);<br />shmop_close($shmid);<br /><br />?> <br />
这段代码报错,请问是怎么回事?
<br />PHP Warning: shmop_read(): no shared memory segment with an id of [194625782<strong>*本文来源gaodai#ma#com搞@代~码^网+</strong><strong>搞代gaodaima码</strong>3] in /home/admin/codes/php/shmop/client.php on line 8<br /><br />Warning: shmop_read(): no shared memory segment with an id of [1946257823] in /home/admin/codes/php/shmop/client.php on line 8<br />
——解决思路———————-
$cont = shmop_read($shmid, 0, “Hello”);