SpyLOG
PHP-Nuke ��-������    �������
���������
��������
 ����
�������
����
 �������
������������
�������
 ������
�������
������
 �����
�������
��������
 �����
������������
�������
 �����
������
���������
������� ���
����� �����

XCIII. ������� Shared Memory

Shmop ��� ����� ����� ������������ �������, ����������� ��� ������ , ����������, ��������� � ������� �������� ��������� ������������ ������ UNIX shared memory). ������� �� ����� �������� � Windows, ��� ��� ��� �� �� ������������ shared-������. ��� ������������� shmop ��� ����� �������������� ��� � ���������� --enable-shmop � ������ ������������.

����������: d PHP 4.0.3 ��� ������� ����� ������� shm ������ shmop.

������ 1. ����� �������� Shared Memory
<?php
   
// ������� 100-������� ���� shared memory � ��������� id if 0xff3
$shm_id = shmop_open(0xff3, "c", 0644, 100);
if(!$shm_id) {
	echo "Couldn't create shared memory segment\n";
}

// �������� ������ ����� shared memory
$shm_size = shmop_size($shm_id);
echo "SHM Block Size: ".$shm_size. " has been created.\n";

// ������� �������� ������ � shared memory
$shm_bytes_written = shmop_write($shm_id, "my ���� shared memory", 0);
if($shm_bytes_written != strlen("my ���� shared memory")) {
	echo "Couldn't write the entire length of data\n";
}

// ������ ��������� ������
$my_string = shmop_read($shm_id, 0, $shm_size);
if(!$my_string) {
	echo "Couldn't read from ���� shared memory\n";
}
echo "The data inside shared memory was: ".$my_string."\n";

// � ������ ������ ���� � ������� ������� shared memory
if(!shmop_delete($shm_id)) {
	echo "Couldn't mark ���� shared memory for deletion.";
}
shmop_close($shm_id);
   
?>
����������
shmop_close - ��������� ���� shared memory
shmop_delete - ������� ���� shared memory
shmop_open - ������ ��� ��������� ���� shared memory
shmop_read - ������ ������ �� ����� shared memory
shmop_size - �������� ������ ����� shared memory
shmop_write - ���������� ������ � ���� shared memory

����� ���������� �����
session_write_close �����shmop_close

RigaNet - Internet studio
For Web site issues, contact the Web master.

Rambler's Top100 �������@Mail.ru SpyLOG RigaNet