What is the scope of require_once in PHP?

后端 未结 4 1595
故里飘歌
故里飘歌 2021-01-08 01:08

Simple question: Is the scope of require_once global?

For example:



        
4条回答
  •  無奈伤痛
    2021-01-08 01:58

    It does not. require_once's tracking applies to inside functions. However, the following scripts produce an error:

    a.php

    
    

    b.php

    
    

    because function f() is not pre-defined to b.php.

提交回复
热议问题