Yum安装的PHP需安装扩展包php-process:
<?php
$shm_key = intval(bin2hex('node'), '16');
$memsize = 120;
$shm_h = shm_attach($shm_key, $memsize, 0644);
$var_key = intval(bin2hex('key'), '16');
$var_value = 'hello';
shm_put_var($shm_h, $var_key, $var_value);
echo shm_get_var($shm_h, $var_key);
shm_remove_var($shm_h, $var_key);
shm_detach($shm_h);
?>
标签:none