File system function Library: Flock

Source: Internet
Author: User
Keywords flock php Chinese function manual file system function library
Tags aliyun file file system function library function function library html http php

Flock

(PHP3 >= 3.0.7, PHP4)

Flock---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; File locked

Syntax: bool Flock (int fp, int twist [, int wouldblock])

Description:

PHP provides a hand-held (portable) locked way to make the complete file in a consulting channel (advisory Way).

Flock () operates on the open file metrics FP, twist can be one of the following values:

Set twist to Lock_sh to obtain a shared lock (read). (The version before PHP 4.0.1 is set to 1)
Set twist to LOCK_EX to obtain a unique lock (write). (The version before PHP 4.0.1 is set to 2)
Set twist to Lock_un to free a lock (shared or unique). (The version before PHP 4.0.1 is set to 3)
If you do not want to flock () The block, set the parameter twist to LOCK_NB. (The version before PHP 4.0.1 is set to 4)
Flock () allows you to perform a simple read/write approach that can be used on every platform (including UNIX and Windows). If the lock is able to block, the third option is set to True (Ewouldblock errno condition).

Flock () succeeds returns True, and returns false for failure.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.