如何解决require_once的问题,我从MAMP开始,我相信这种冲突

时间:2019-06-14 19:50:42

标签: php mamp

使用mamp运行项目时,我创建了以下错误:

  

警告:require_once(/Applications/MAMP/htdocs/saml/lib/_autoload.php):无法打开流:/ Applications / MAMP / htdocs / academanabi / Sistema / xolat / web / portal中没有此类文件或目录/index.php,第41行

     

严重错误:require_once():无法打开所需的'/Applications/MAMP/htdocs/saml/lib/_autoload.php'(include_path ='。:/ Applications / MAMP / lib /:/ Applications / MAMP / lib /原则:/ Applications / MAMP / lib / excellib:/ Applications / MAMP / lib / excellib / PHPExcel:/ Applications / MAMP / lib / ActiveRecord:/ Applications / MAMP / lib / ActiveRecord / database:/ Applications / MAMP / lib / ActiveRecord / database / drivers / postgre:/ Applications / MAMP / htdocs / academanabi / Sistema / xolat / apps / portal / models / business:/ Applications / MAMP / htdocs / academanabi / Sistema / xolat / apps / portal / models / domain:/应用程序/ MAMP / htdocs / academanabi / Sistema / xolat / apps / portal / models / domain / generated:/ Applications / MAMP / htdocs / academanabi / Sistema / xolat / apps / portal / validators:/ Applications / MAMP / htdocs / academanabi / Sistema / xolat / apps / portal / services:/ Applications / MAMP / lib / ZendExt / Trace / business:/ Applications / MAMP / lib / ZendExt / Trace / domain:/ Applications / MAMP / lib / ZendExt / Trace / domain / generated :/ Applications / MAMP / lib / ZendExt / Metadata / domain:/ Applications / MAMP / l ib / ZendExt / Metadata / domain / generated:/位于第41行/Applications/MAMP/htdocs/academanabi/Sistema/xolat/web/portal/index.php中的Ap

<?php
    /**
     * Fichero de inicio del modulo
     * 
     * @author Yoandry Morejon Borbon
     * @copyright UCID-ERP Cuba
     * @version 1.0-0
     */

    //Direccion de la servidora
    $dir_index = __FILE__;

    //Direccion del fichero de configuracion
    $config_file = substr($dir_index, 0, strrpos($dir_index, 'web')) . 'apps/comun/config.php';

    if (!file_exists($config_file)) //Si no existe el fichero de configuracion
    {
        //Se dispara una excepcion
        throw new Exception('El fichero de configuracion no existe');
    }
    elseif (!is_readable($config_file)) //Si no se puede leer
    {
        //Se dispara una excepcion
        throw new Exception('No se pudo leer el fichero de configuracion. Acceso denegado.');
    }
    else //Si existe el fichero y se puede leer
    {
        //Se inicializa la variable de configuración
        $config = array();

        //Se incluye el fichero

        include_once ($config_file);

        if (!isset($config['include_path']))
            throw new Exception('El framework no esta configurado correctamente.');

        //Se inicializa el include path de php a partir de la variable de configuracion
        set_include_path($config['include_path']);

        require_once($config['SAML']);
        //Se inicia la carga automatica de clases y ficheros
        $loader_file = 'Zend/Loader/Autoloader.php';
        if (!@include_once($loader_file))
            throw new Exception('El framework no esta configurado correctamente.');
        $autoloader = Zend_Loader_Autoloader::getInstance();
        $autoloader->setFallbackAutoloader(true);
        //Se inicia la aplicacion
        $as = new SimpleSAML_Auth_Simple('auth');
        $as->requireAuth();
        $app = new ZendExt_App();
        $_SESSION['login_user']=true;
        $app->init($config,$as);
    }

_自动加载

/**
 * This file implements a autoloader for simpleSAMLphp. This autoloader
 * will search for files under the simpleSAMLphp directory.
 *
 * @author Olav Morken, UNINETT AS.
 * @package simpleSAMLphp
 * @version $Id$
 */


/**
 * Autoload function for simpleSAMLphp.
 *
 * It will autoload all classes stored in the lib-directory.
 *
 * @param $className  The name of the class.
 */
function SimpleSAML_autoload($className) {

    $libDir = dirname(__FILE__) . '/index.php';

    /* Special handling for xmlseclibs.php. */
    if(in_array($className, array('XMLSecurityKey', 'XMLSecurityDSig', 'XMLSecEnc'), TRUE)) {
        require_once($libDir . 'xmlseclibs.php');
        return;
    }

    /* Handlig of modules. */
    if(substr($className, 0, 7) === 'sspmod_') {
        $modNameEnd = strpos($className, '_', 7);
        $module = substr($className, 7, $modNameEnd - 7);
        $moduleClass = substr($className, $modNameEnd + 1);

        if(!SimpleSAML_Module::isModuleEnabled($module)) {
            return;
        }

        $file = SimpleSAML_Module::getModuleDir($module) . '/lib/' . str_replace('_', '/', $moduleClass) . '.php';
    } else {
        $file = $libDir . str_replace('_', '/', $className) . '.php';
    }

    if(file_exists($file)) {
        require_once($file);
    }
}

/* Register autoload function for simpleSAMLphp. */
if(function_exists('spl_autoload_register')) {
    /* Use the spl_autoload_register function if it is available. It should be available
     * for PHP versions >= 5.1.2.
     */
    spl_autoload_register('SimpleSAML_autoload');
} else {

    /* spl_autoload_register is unavailable - let us hope that no one else uses the __autoload function. */

    /**
     * Autoload function for those who don't have spl_autoload_register.
     *
     * @param $className  The name of the requested class.
     */
    function __autoload($className) {
        SimpleSAML_autoload($className);
    }
}

?>

0 个答案:

没有答案