How to check if a defined constant exists in PHP?

后端 未结 6 542
一整个雨季
一整个雨季 2020-12-29 19:35

So I\'m using a PHP framework called fuelphp, and I have this page that is an HTML file, so I can\'t use PHP in it. I have another file tha

6条回答
  •  一个人的身影
    2020-12-29 19:47

    First, these are not variables, but constants.

    And you can check their existence by using the defined() function :

    bool defined ( string $name )
    

    Checks whether the given constant exists and is defined.

提交回复
热议问题