本文介绍了卷曲:多个Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为每个客户/电脑运行多个Cookie来运行脚本?
How can I have multiple cookies for each Client/PC to run a script?
如果ComputerA运行脚本,则会创建cookies.txt,
If ComputerA run a script then cookies.txt will be created and also ComputerB run same Script then cookies.txt will be over written which is bad.
例如:
curl_setopt($ch,CURLOPT_COOKIEFILE,"cookie.txt");
curl_setopt($ch,CURLOPT_COOKIEJAR,"cookie.txt");
推荐答案
如果它们是独立的计算机,
If they're seperate computers, then it's seperate file systems and each will have its own cookie file.
但如果您使用共享存储,则使用动态文件名,可能
But if you're on shared storage, then use a dynamic filename, perhaps
'cookie-' . $_SERVER['SERVER_NAME'] . '.txt'
。
cookie-ComputerA.txt cookie-ComputerB.txt etc...
这篇关于卷曲:多个Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!