vendredi 9 mars 2018

php if query works with wamp but not on live server

I'm using the code below to choose an image based on the domain.

the only difference between environments is wamp is running PHP 7 and my host 7.1 and I've been unable to get a copy of wamp with PHP 7.1 included.

on the live site, the end result is a blank white page with the PHP error on the 'else' line

I'm not sure if this is correct but after $logo_img = "3_logo.svg" if I add the semicolon you get a white page but without works just fine.

<?php
    $host = $_SERVER['HTTPS_HOST']; 
    $logo_img = '';

    if($host == "domain1.co.uk") {
        $logo_img = "1_logo.svg"; 
    }
    elseif($host == "domain2.co.uk") {
        $logo_img = "2_logo.svg"; 
    }
    elseif($host == "domain3.co.uk") {
        $logo_img = "3_logo.svg"
    }



?>

any help appreciated!!

Aucun commentaire:

Enregistrer un commentaire