douqingzhi0980 2013-11-30 00:18
浏览 25
已采纳

第1行的PHP语法错误

Below is the code for a simple php file with some functions that run perfectly happily when the inside of the php tag is commented out. isLoggedIn() is a function that I know is coded correctly in the session.php file as it is used elsewhere and works.

For some weird reason, firefox console is telling me there is a syntax error on line 1:

[00:11:56.115] SyntaxError: syntax error @ admin_script.php:1

Any help would be greatly appreciated!

<?php
include('../includes/session.php');
if(isLoggedIn() == false)
{
header('HTTP/1.0 404 Page Not Found');
}
?>


$(document).ready(function(){
/* All the JS code here for the admin page to be sent to the HTML.
Two functions, one needs to provide the sections to the "editor-sections" div and another the content to the "editor-content" div.
*/

$('button[id=exercises_button]').click(function(){
exercise_editor();
});

$('button[id=problems_button]').click(function(){
problems_editor();
});

var exercise_editor = function(){
window.alert("Exercise button clicked");
};

var problems_editor = function(){
window.alert("Problems button clicked");
};
});

Thank you!

  • 写回答

3条回答 默认 最新

  • douyi8760 2013-11-30 15:46
    关注

    So I solved it, thank you for all your responses, but the directory was all correct and everything. I decided to re-write the small php segment, just wondering if spaces made any difference (even though I knew they wouldn't) and miraculously it worked. I believe that the location of the heaader() was causing the trouble as when I re-wrote it, I simply changed it to header('Location: http://www.google.com and no problem came about.

    So very very strange, especially as the change had nothing to do with line 1. Thank you for all your responses!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题