首页  >  文章  >  后端开发  >  请教内存共享的问题!

请教内存共享的问题!

WBOY
WBOY原创
2016-06-23 13:49:09947浏览


代码如下:

<?php$sysid = $shmkey = ftok(__FILE__, 't');$flags = "c";$mode = 0766;$size = 1024;$shmid = shmop_open($sysid, $flags, $mode, $size);shmop_write($shmid, "Hello", 0);$len = shmop_size($shmid);$cont = shmop_read($sysid, 0, "Hello");var_dump($cont);shmop_delete($shmid);shmop_close($shmid);?> 

这段代码报错,请问是怎么回事?
PHP Warning:  shmop_read(): no shared memory segment with an id of [1946257823] in /home/admin/codes/php/shmop/client.php on line 8Warning: shmop_read(): no shared memory segment with an id of [1946257823] in /home/admin/codes/php/shmop/client.php on line 8



回复讨论(解决方案)

$cont = shmop_read($shmid, 0, "Hello");

$cont = shmop_read($shmid, 0, "Hello");



艾玛,又犯低级错误,非常感谢!
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn