脚本宝典收集整理的这篇文章主要介绍了php – file_put_contents上的互斥标志?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
FILE_APPEND:
LOCK_EX:
<?PHP $file = 'people.txt'; // The new person to add to the file $person = "John SmITh\n"; // Write the contents to the file,// using the FILE_APPEND flag to append the content to the end of the file // and the LOCK_EX flag to prevent anyone else writing to the file at the same time file_put_contents($file,$person,FILE_APPEND | LOCK_EX); ?>
那么,FILE_APPEND和LOCK_EX标志是否相互排斥?如果是,为什么他们在示例中使用它?这是一个糟糕的文件案例吗?
感谢您的输入!
你说的例子是:
<?PHP $file = 'people.txt'; // The new person to add to the file $person = "John Smith\n"; // Write the contents to the file,FILE_APPEND | LOCK_EX); ?>
看起来编写这个例子的人误解了“互相排斥”的含义,或者产生了一些秘密的,无证件的行为.
以上是脚本宝典为你收集整理的php – file_put_contents上的互斥标志?全部内容,希望文章能够帮你解决php – file_put_contents上的互斥标志?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。