VARIABLE,但这并不意外
我收到一个错误:
解析错误:语法错误,第4行中home2 / chippery / public_html / login / text / loginStuff.php中意外的T_VARIABLE
第4行:
$ pass = $ _POST ['password']
但是,第3行工作正常:
$ user = $ _POST ['username']
帖子来自:
<html>
<form action='loginStuff.php' method='POST'>
User: <input type='text' name='username'><br>
Pass: <input type='password' name='password'><br>
<input type='submit' value='Log In'>
</form>
</html>
我刚刚进入PHP(不到一个小时前),所以我确信这是一个愚蠢的错误,但你能弄清楚什么是错的?
每行末尾需要分号。
用分号结束条件/变量赋值/手动操作;
例:
$Username = $_POST['Username']; // Solution
$Password = $_POST['Password']; // Solution
$Username = trim($_POST['Username']); // Example only
但不适用于if语句:
if (isset($_POST['Username'])){
if (isset($_POST['Username'])){
$Username = $_POST['Username'];
}
} // No semi colon needed here, only inside the braces
链接地址: http://www.djcxy.com/p/69231.html