I tried to define constants in my config.php file. Its primary use is just configuration, as I'm sure you guessed. But it isn't working. here's my config.php file:
<?php
define("KPEREQUEST", "0", true);
define("KPERESPONSE", "1", true);
define("KPEGET", 0, true);
define("KPEPOST", 1, true);
?>
and here's the result when I include config.php and print the define kPAPost:
KPEPOST: ""
but here's the result if i define the constants in index.php AND i print them from index.php:
KPEPOST: "1"
** EDIT **
heres my index.php file:
<?php
$title = "API Documents";
include 'header.php';
include "config.inc.php";
echo "KPEPOST: \"" . KPEPOST . "\"";
?>
<?php include 'footer.php'; ?>
I've seen this done a million times in wordpress, magento, etc. I have no idea why this isn't working and I've done a ton of research to figure it out but I'm at a dead end now. Any help would be appreciated. Why can't I define a constant in a config file and use the define in files that include the config file?
kPAPostis not defined did you meanKPEPOSTrequireinstead ofinclude.