Home  >  Article  >  Backend Development  >  请问下面的问题怎么解决?

请问下面的问题怎么解决?

WBOY
WBOYOriginal
2016-06-23 13:59:42851browse

一个php程序部署在两台或两台以上的服务器上,这个php要在一个共享目录下建立一个文件夹,名字是一个ID。这个文件夹这个ID是调用这个php的web系统传过来的。但是有可能不同的用户访问不同的服务器,但是发送的ID相同。(别的参数不同)。请问我怎样采用同步的策略,保证两台服务器不会同时建立相同的文件夹。谢谢!


回复讨论(解决方案)

php 能访问共享目录吗?应该不可以的

php 能访问共享目录吗?应该不可以的
比如php在A服务器上运行,不能在服务器B上的某个目录下建立文件夹吗?

php 无此功能
但你可以尝试用 file_get_contents 和 file_put_contents 读写已存在的目录(不保证成功)

请教斯诺登

用函数确实不行,但是我用命令可以实现。比如mkdr,copy命令。
请问两天服务器怎么能够保证建立同一个目录一次?

学习学习,

用/可以解决。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn