常量已经在PHP中定义 [英] constant already defined in php

查看:53
本文介绍了常量已经在PHP中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在尝试运行的函数,但它显示的消息是
CONSTANT已经定义。

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 but still nothing. Is there any method to ignore this and see the output?

推荐答案

替换为:

define('constant', 'value');

其中:

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

这篇关于常量已经在PHP中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆