douqingzhi0980 2013-11-29 16: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 07: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条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部