致命错误:命名空间声明语句必须是脚本中的第一条语句 [英] Fatal error: Namespace declaration statement has to be the very first statement in the script

查看:555
本文介绍了致命错误:命名空间声明语句必须是脚本中的第一条语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

加载签名脚本时出现错误.错误如下:

I get an error when I load the signing script. The error is as followed:

名称空间声明语句必须是第1行/Applications/MAMP/htdocs/lphoto/cms/phps/php/class/db.php中脚本中的第一条语句.

Namespace declaration statement has to be the very first statement in the script in /Applications/MAMP/htdocs/lphoto/cms/php/class/db.php on line 1

我使用以下脚本/页面

signin.php

<?php namespace scripts;
 // get the auth class and the db settings
require_once("class/auth.php");

use scripts\auth\auth as authClass;

auth.php

<?php namespace scripts\auth;

require_once 'db.php';

//use scripts\db\db as Database;

class auth extends Database

db.php

<?php namespace scripts\db;


/**
 * Author: Lennard Moll
 * Licence: GNU GPL 3
 * Last edited 18 July 2015
 */

require_once  'db_conf.php';

use scripts\db\db_config as conf;

db_conf.php

<?php 

namespace scripts\db;

我不知道问题出在哪里.希望任何人都知道如何解决它.预先感谢

I don't know where the problem is. Hope any of you know how to fix it. Thanks in advance

推荐答案

检查php标记和名称空间之间是否存在空格. Maybee这些空白不会显示在您的编辑器中.

Check for whitespaces between the php tag and the namespace. Maybee these white space is not shown in your editor.

这篇关于致命错误:命名空间声明语句必须是脚本中的第一条语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆