Data Storage



Php Data Storage

Records of data sets for common memory using php
Как организовать хранение пользователей в базе данных с разными

First parameter is system ID. This is the number defining the general memory segment of the system. The second is the access regime, which is very similar to the fopen mode of access. Four ways can be accessed to the segment:

  • The " a " regime allows for only reading the segment;
  • The " w " regime allows for a reading and recording segment;
  • (c) A new segment is being established and, if it already exists, an attempt is made to open it for reading and recording;
  • The " n " regime creates a new segment, and if it already exists, a misstatement is issued.

Third parameter is the permit for the segment. There's a number eight.

The fourth parameter indicates the size of the segment in the whites. The necessary number of bikes in the segment should be identified before recording the data.

Note that this function reverts the identification number that can be used with other functions to manipulate the common memory segment. It's a common memory identifier different from a system identifier transmitted as a parameter. Don't confuse them. In case of failure, the shmop_open function will return the FALSE value.

Inscriptions to segments

Use shmop_write to record data in the common memory block. She's very simple in application and only accepts three parameters. See leaflet 2.

Listing 2. Application of shmop_write to record in the memory block

It resembles the function fwrite, which takes two parameters: an open flow resource returned by the function fopen and the data to be recorded. The function of shmop_write does the same thing.

The first parameter is the identifier returned by the shmop_open function, which defines the common memory block you're going to work with. The second parameter is data to be stored and, finally, the third parameter defines the address of the recording. Default is 0, so the record starts at the beginning. In the event of failure, this function returns the value of FALSE and the number of successful tags.

Segment reading

Reading from the general memory segments is a simple procedure. Open the segment and use the shmop_read function. It accepts several parameters and works similar to fread. Leafing 3 gives an example of reading the contents of the PHP file.

Related posts:

  1. Data Storage Used
  2. Hdd For Data Storage
  3. 1C Data Storage