doukan6564 2014-10-02 17:22
浏览 20
已采纳

什么时候包括处理静态功能?

Consider the following:

class MyClass { 
    public static function MyIncludingMethod() {
        include_once("includes.php");
    }

    public static function MyOtherMethod() {
    }
}

Assuming this is valid- when will includes.php be included?

Option 1) When the php file containing all of this is included

Option 2) When MyClass::MyIncludingMethod() is called

Option 3) When anything from MyClass is called, even if MyClass::MyIncludingMethod() has not been called

  • 写回答

1条回答 默认 最新

  • dpr26232 2014-10-02 17:33
    关注

    includes.php:

    <?php
      touch('i_was_called.txt');
    ?>
    

    Results

    1. No
    2. Yes
    3. No

    Everything is as expected :)

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

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的解释说明
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备