dongxinm279890 2018-09-04 15:21
浏览 739

警告:使用未定义的常量php - 假设'php'(这将在PHP的未来版本中引发错误)在第1行的*中[重复]

This question already has an answer here:

I'm following the tutorial here to create a login page using MySQL. The code seemed to be working flawlessly when I left my computer 2 days ago. Now I come back to work on it, haven't changed anything, and I'm greeted with this warning:

Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /filelocation/login.php on line 1

Line 1 in login.php literally says only this:

<?php

It also seems like this warning is breaking the form. When I hit the "login" button, nothing happens besides being redirected right back to the login page to try again.

Why would this be happening?

edit* As requested here is the fist couple lines of my code. Simply copy-pasted:

<?php
// Initialize the session
session_start();

// Check if the user is already logged in, if yes then redirect him to welcome page
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){
    header("location: welcome.php");
    exit;
}
</div>
  • 写回答

1条回答 默认 最新

  • duanniesui6391 2018-09-04 16:07
    关注

    Well, I got something that seems to work. When uploading my file with filezilla, I am greeted with this Warning.

    I decided to try a different FTP program to upload (NppFTP to be specific) and my problem went away. I still have no idea why this works though! Any body know why that might be an issue?

    评论

报告相同问题?

悬赏问题

  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题