constant already defined in php

前端 未结 3 1180
庸人自扰
庸人自扰 2020-12-24 11:32

I have a function that I am trying to run but it shows the message as CONSTANT already defined.

I tried to put a condition saying \"if defined\" about the function

3条回答
  •  星月不相逢
    2020-12-24 11:56

    Replace this:

    define('constant', 'value');
    

    with this:

    if (!defined('constant')) define('constant', 'value');
    

提交回复
热议问题