php-No code may exist outside of namespace

Status
Not open for further replies.

addisoncave

Active Member
42
2016
1
0
my php interpreter returning giving the error while executing the following code

PHP:
<?php/* *@Package Name: lib/includes.php *@Date(Last Modified): Tue, Sept 6 - 2016 */
namespace lib\includes{        class accessControl    {        private function init()        {            define('DS',DIRECTORY_SEPARATOR);            define('ROOT',getcwd().DS);            /*             * @var THEME_NAME has been Fetch from Database             */            define('THEME_NAME','');            define('THEME_PATH',ROOT.'mads-content'.DS.'mads-themes'.DS.THEME_NAME.DS);            define('CONTROL_PATH',ROOT.'mads-admin'.DS.'contoller'.DS);            define('MODEL_PATH','mads-admin'.DS.''.DS);


        }    }
}include_once("config.php");?>
I need Config.php to get database access so i could get the name of theme
fetal error on line 30 of include.php "No code may exist outside of namespace"
 
2 comments
That line says it already, You have code outside the namespace:

It's this code that is causing it:
Code:
[COLOR=#000000][FONT=monospace]include_once("config.php");[/FONT][/COLOR]

You could place it a bracket higher, if it was supposed to be there.
 
you should put this in first line after php

PHP:
include_once("config.php");


or the best thing is to replace include_once with require or include
 
Status
Not open for further replies.
Back
Top