mercredi 2 septembre 2015

Shorthand PHP Environment Variables

I'm looking to transition from Localhost to Dev to East/West staging environments to production without having to change the PHP files, but I don't think my code is correct and it could be my shorthand, I'm new to this.

What I'm hoping to do is say, if localhost then else if dev, else if staging east, else if staging west, else if production. Maybe there's a better way of doing this?

If it helps, I'm using Apache as my local host and Azure in dev/staging/production, I'd use both but I don't have access to Azure.

<?php
$thisPage = "navigation";
define('URL_ROOT',
            getenv('DEV_SERVER') ?
                'http://localhost/Site/' :
                'dev.website.net' :
                'http://ift.tt/1hybY0A' :
                'http://ift.tt/1EyCq4P' :
                'http://ift.tt/1hybVC0'
);
?>

Aucun commentaire:

Enregistrer un commentaire