[文章作者:张宴 本文版本:v1.1 最后修改:2007.08.23 转载请注明出处:http://blog.zyan.cc]

  最近在工作中遇到一个问题:a.php程序需要将接收到的数据同时写到“线上运行的正式数据库”和“进行开发调试的测试数据库”。而测试数据库可能经常会面临对表结构、字段、配置信息做调整等问题,很不稳定,发生错误的概率很高,如果用a.php程序同时写“正式数据库”和“测试数据库”,势必影响到线上运行的正式服务。

  于是,我想到用PHP curl扩展库将生成的$data数组post传递一份给b.php程序,然后a.php程序继续往下执行写“正式数据库”的代码。a.php程序将$data数组传递给b.php程序就完事了,至于b.php如何处理,就不关a.php的事了,b.php程序即使写“测试数据库”失败,也不会对a.php程序造成影响。

  点击在新窗口中浏览此图片

  按照这种思路,我写了a.php和b.php的代码:

  a.php程序源代码:

  b.php程序源代码:


  备注:这两段代码需要php curl扩展库的支持,查看phpinfo(),如果cURL support  enabled则表示支持curl库。
  1、Windows下的PHP开启curl库支持:
  打开php.ini,将extension=php_curl.dll前的;号去掉。

  2、Linux下的PHP开启curl库支持:
  编译PHP时在./configure后加上 --with-curl


Tags:



技术大类 » PHP/JS/Shell | 评论(40) | 引用(0) | 阅读(54110)
xujie777 Email
2012-5-18 16:21
coach outlet has become a popular shopping experience for consumers around the world, and a desirable distribution channel for manufacturer's and retailers.Getting your hands on coach outlet store online can be a hefty investment of hundreds of dollars.But do not despair,the Coach Outlet store could be the answer to your prayers.coach outlet online is your smart choice when you want to get the discount Coach accessory. You can find the exact Coach Bags and other accessory you want at a low price that's right for you. My dear friends, let the coach outlet online pave your way into the world of high fashion with their ultimate fashion factory.
xujie123
2012-5-21 11:06
Our online store offers you discounted Designer louis vuitton replica wallet at present. You could find them in desirable quality and price. If you don't mind high class louis vuitton uk, have a good time here.louis vuitton Store Online Handbags can also bring great accuracy as well as practical applicability and fashionable.Have you ever dreamed of being as charming as Madonna? Have you ever thought of becoming an envy of all your friends? If so, come to louis vuitton outlet.<br/>
xujie555
2012-5-21 13:30
coach factory outlet uses graceful accessories to match the classical logo of coach, which is the best combination of coach. The handmade coach products?can make you more charming and graceful.coach factory online provides people many coach goods. If you wish to snatch the coach handbag, then this best method is made for that you like for coach discount.coach factory outlet online is a fashion brand to ensure its quality. With designer coach shoulder bags, you will always attract people's attention. The bags will emphasize your personal style and taste.<br/>
xujie333
2012-5-21 14:51
coach outlet online Store guarantee that all the coach handbags offered are own high quality. In addition , all of them are sold at an unexpected low price.If you want to purchase, just visit their website.coach factory outlet is really sizzling kinds of shopping way for you. With the usage of the replica designer coach bags, you can surely be able to change your individual looks in a stunning manner.Coach bags on sale from the coach outlet are cheap or discount prices that you certainly will stand out from the crowd on your next camping trip!<br/>
coach88888888 Email
2012-8-13 17:37
If you desire to go to Coach Factory Outlet, but have no idea in which to go, you can research online. It is no doubt that there is drastically information and details about it for the reference.Coach Factory Online are loved by many people, when you walk in the street, you could see many people take coach styles.hat experts claim Coach Outlet Online shopping is in the changes they are available in.Coach Outlet will send you a coupon in the post to use in their upon only after you type a achieve. The Coach bags are customarily somewhat many than the ones in the stores.
SteveBrad Email
2012-10-10 17:16
Your website is almost certainly surely the greatest . Over-all perception of the page is probably lovely. | Generic Viagra |
修改分数+QQ:862488826 Email
2012-12-26 18:22
修改造价工程师考试分数成绩QQ:862488826修改结构工程师考试分数成绩
磨延城 Email Homepage
2013-10-21 20:58
磨途歌学习了
adsf
2013-12-9 16:54
买轴承就到:www.jkzhoucheng.cn
shz Email
2022-7-20 23:43
If it's not too much trouble share more like that.  Scam Risk
shzz Email
2022-7-20 23:46
Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best.  Scam Risk
shz Email
2022-7-20 23:50
After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.  Scam Risk
shz Email
2022-7-20 23:52
This post is very simple to read and appreciate without leaving any details out. Great work!  Scam Risk
shz Email
2022-7-21 01:32
I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site.  Scam Risk
shz Email
2022-7-21 01:36
I truly like you're composing style, incredible data, thankyou for posting.  Scam Risk
shz Email
2022-7-21 01:39
I would recommend my profile is important to me, I invite you to discuss this topic...  Scam Risk
shz Email
2022-7-21 01:51
Always so interesting to visit your site.What a great info, thank you for sharing. this will help me so much in my learning  Scam Risk
Lucky cola
2024-2-7 16:42
Enter the gaming arena and let the games begin!  Lucky cola
分页: 2/2 第一页 上页 1 2 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]