Home  >  Article  >  Backend Development  >  请教内存共享的问题!

请教内存共享的问题!

WBOY
WBOYOriginal
2016-06-23 13:49:09906browse


代码如下:

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



艾玛,又犯低级错误,非常感谢!
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