PHP end script but does not affect the subsequent HTML output
Maybe it's a little white problem.
Like what:
if (!isset ($_get["id"]) | |! Isset ($_get["code"))
{
echo "Registration verification";
Exit ();
}
Else
{
echo "Registration Verification 1";
}
......
?>
This script, for example, is in its own HTML <title>To determine if there is data for the get commit to output a different title</title>
There's a script behind it, but if get doesn't have data, then it's not necessary to connect to the database, so I want to end it.
But after the end, use Exit or return, in the back HTMLContent and so on will not output, how to do?
------Solution--------------------
Cannot exit ();
Instead, put the connected database or something in the Else branch
------Solution--------------------
You can also put these PHP code in a separate file, include in
Just to put exit (); Change to return;
------Solution--------------------
This post was last edited by xuzuning on 2013-02-21 12:57:32
You can also write a function
As structured programming, nothing is
If Else
If ElseIf else
Switch case Default
The alternative point is
While break
Really don't like structured programming when
php5.3 has resumed support for Goto, and proper use is pretty good.
Goto A;
Echo 123; It won't be executed here.
A:
Echo ' ABCD ';