ds3422222222 2013-04-29 15:24
浏览 76
已采纳

覆盖包含php中的函数?

Is there a way to override include functions (include, include_once, require, require_once, etc) in PHP? I want to be able to do some code before including a file in the script. I'm working on a system that will allow plugins to be installed, but I don't want a plugin opening one or more of the core files and viewing their content. So I would like to be able to block these files when using include functions (especially file_get_contents()) but I obviously can't simply disable these functions.

I have thought about just changing the owner/access rights to these files, but apache needs read/execute rights to these so automatically, we can get their content by using file_get_contents();

Is there a way I can do that? Or am I viewing this the wrong way??

Thank you very much.

  • 写回答

1条回答 默认 最新

  • dounabi6295 2013-04-29 15:34
    关注

    If it is worth spending the processing power, you can use fopen or file_get_contents to read the PHP files as text and search for the forbidden functions, then include or ignore them based on the result.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line