Home >Backend Development >PHP Tutorial >请问内存共享的有关问题!

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:06:351114browse

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

代码如下:

<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");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn