PHP Short Open Tag打印“1”

When i write php code with html using php short open tag, it prints 1 every time.

<?= include_once 'includes/footer.php';?>

Why it's happening ?

Because it returns true. You need to use include_once without the short open tag, so like this:

<?php include_once 'includes/footer.php';?>

When you write an open short tag, like this;

<?= include_once 'includes/footer.php';?>

You actually write this:

<?php echo include_once 'includes/footer.php';?>

Which results in "1" on your screen.

Php Short Tag is used to echo the variable not for including the file

<?= ?> (echo short tags)

See this http://php.net/manual/en/language.basic-syntax.phptags.php

Because include_once return TRUE, so if you print it it will display "1"

Just remove the "=" sign and try. In short tags "=" used for echo and since you're including the file without any problem it returns 1 and it will be echoed back.

Happy Coding...!!! :)