php 一段 shmop
1 $size = 1024*1024; 2 3 $shm_key = ftok(__FILE__, 't'); 4 5 $shm_id = shmop_open($shm_key, "c", 0644, $size); 6 7 $id = sem_get($shm_key); 8 9 $data = shmop_read($shm_id, 0, $size); 10 11 $arr = array( 12 'time'=>time(), 13 'data'=>uniqid() 14 ); 15 16 $size = shmop_write($shm_id, json_encode($arr), 0); 17 18 $data = shmop_read($shm_id, 0, $size); 19 sem_release($id);