0

どうすれば最上位ディレクトリに設定できますか (つまりpublic_html/folder)?

私は$_SERVER['DOCUMENT_ROOT']運がないことを試みました。

define('JPATH_BASE', dirname(realpath(__FILE__)). '/folder' );

編集: これが役立つ場合に備えて、コード全体を次に示します。

<?php

// Set flag that this is a parent file

define( '_JEXEC', 1 );

define('JPATH_BASE', dirname(realpath(__FILE__)). '/folder' );

define( 'DS', DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
jimport('joomla.application.module.helper');
jimport('joomla.application.component.helper');

$mainframe =& JFactory::getApplication('site');

if (!$mainframe->getCfg('offline'))
        {
    echo "Folder is <span style=\"color:green;\">online</span>.";
    }
?>
4

2 に答える 2

0

DOCUMENT_ROOT を探していると思います。

于 2013-04-22T18:02:04.770 に答える
0

これを試して:

    <?php
function getPublicHTML(){
    $get = 'public_html';
    $d = '';
    for($i = 0; $i < 20; $i++){
        if(file_exists($d.$get)){
            return $d;
        }else{
            $d.="../";
        }
    }
    return $d;
}

define("JPATH_BASE", getPublicHTML());
?>

Wamp サーバーの下で動作します

于 2013-04-22T18:07:30.323 に答える