Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   why this code is not working? (http://siteownersforums.com/showthread.php?t=177554)

addisoncave 09-07-2016 10:28 PM

why this code is not working?
 
Hi guys I'm working with following codes and it's not working and returning a fetal error that anything must not written outside name space

PHP Code:

<?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");
?>

How to fix this?

hillajax 09-13-2016 04:50 AM

a function can'd be worked outside the scope of a namespace that's why your code is not working. place include function inside the namespace block.


All times are GMT -7. The time now is 02:43 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.