首頁 >後端開發 >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