samedi 17 mars 2018

PHP file_get_contents and if returns false

I have a variable that comes from the "file_get_contents()" function. Using this variable with an if function always gives false.

$content = file_get_contents($url);
echo $content; // Echos 1
if ($content == "1") {
    // It doesn't matter if I use 1, '1' or "1"
    echo "True";
}
else {
    echo "False"; // Always echos this one.
}

Aucun commentaire:

Enregistrer un commentaire