首页 >后端开发 >php教程 >请问内存共享的有关问题!

请问内存共享的有关问题!

WBOY
WBOY原创
2016-06-13 12:06:351077浏览

请教内存共享的问题!!!

代码如下:

<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 [1946257823] 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");

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn