for example , open 01.php in firefox , open 02.php in google chrome ,
01.php create shared memory segment , 01.php write msg shared memory segment ,
, want 02.php access shared memory segement , read msg .
can successed ? , how ?
i know if use read-write file instead of use shared memory , can successed .
if sharing memory want achieve use apc extension.
01.php
<?php $bar = 'some value'; apc_store('myuniquekey', $bar); 02.php
var_dump(apc_fetch('myuniquekey')); edit:
there's way wasn't aware of - without using apc: http://php.net/shmop. little more complex , ugly have allocate space , stuff, more shmop extension available without beeing required install manually.
$shm_id = shmop_open(0x123, 'c', 0644, 250); shmop_write($shm_id, "data in shared memory", 0); $value = shmop_read($shm_id, 8, 6);
Comments
Post a Comment