dongyong6045 2014-05-31 12:05
浏览 18
已采纳

巨大的PHP文件脚本[关闭]

I have PHP script (machine generated), that has size of 3MB. Its content is mainly couple of switches and echo. It is not doint anything, only echos. I am using it as "cache" for slow SQL queries, so I generate all possible outputs to this PHP and then use ID in URL to get appropriate result.

So far I have been using script that has 700KB and all was OK. Now, I added some data and I ended up with 3MB. Is it OK to run this or should I consider some other solution ?

  • 写回答

2条回答 默认 最新

  • douguabu8960 2014-05-31 12:31
    关注

    It sounds like you're rolling your own wonky wheel. Consider using a widely accepted caching solution like APC or memcache.

    Also consider using the Zend caching component which can be extracted and used in isolation from the rest of the framework and provides an abstracted API for many caching back ends including file based, APC and memcache.

    The solution you've described will probably use excessive memory for every execution, waste CPU parsing unnecessary PHP code and make it difficult to handle things like invalidations.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?