1

最初に申し訳ありませんが、私は本当に初心者なので、気が向いたらこの質問に反対票を投じることができます。

だから私は多くのチュートリアルを調べましたが、私にとってうまくいく唯一のことは、パブリックフォルダーのコンテンツを引き出すことです.

そして問題は、たくさんのエラーが発生することです。

エラー:

Warning: require(\bootstrap.php) [function.require]: failed to open stream: No such file or directory in C:\EasyPHP\www\fuelphp\index.php on line 33

Fatal error: require() [function.require]: Failed opening required '\bootstrap.php' (include_path='.;C:\php\pear') in C:\EasyPHP\www\fuelphp\index.php on line 33

DOCROOT がC:\EasyPHP\www\fuelphp\であることを発見したので、この方法で何かをプルする必要があります

元のインデックスは次のようになります

<?php
/**
 * Set error reporting and display errors settings.  You will want to change these when in production.
 */
error_reporting(-1);
ini_set('display_errors', 1);

/**
 * Website document root
 */
define('DOCROOT', __DIR__.DIRECTORY_SEPARATOR);

/**
 * Path to the application directory.
 */
define('APPPATH', realpath(__DIR__.'/../fuel/app/').DIRECTORY_SEPARATOR);

/**
 * Path to the default packages directory.
 */
define('PKGPATH', realpath(__DIR__.'/../fuel/packages/').DIRECTORY_SEPARATOR);

/**
 * The path to the framework core.
 */
define('COREPATH', realpath(__DIR__.'/../fuel/core/').DIRECTORY_SEPARATOR);

// Get the start time and memory for use later
defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true));
defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage());

// Boot the app
require APPPATH.'bootstrap.php';

// Generate the request, execute it and send the output.
try
{
    $response = Request::forge()->execute()->response();
}
catch (HttpNotFoundException $e)
{
    $route = array_key_exists('_404_', Router::$routes) ? Router::$routes['_404_']->translation : Config::get('routes._404_');
    if ($route)
    {
        $response = Request::forge($route)->execute()->response();
    }
    else
    {
        throw $e;
    }
}

// This will add the execution time and memory usage to the output.
// Comment this out if you don't use it.
$bm = Profiler::app_total();
$response->body(
    str_replace(
        array('{exec_time}', '{mem_usage}'),
        array(round($bm[0], 4), round($bm[1] / pow(1024, 2), 3)),
        $response->body()
    )
);

$response->send(true);

これに変更されたよりも

<?php
/**
 * Set error reporting and display errors settings.  You will want to change these when in production.
 */
error_reporting(-1);
ini_set('display_errors', 1);

/**
 * Website document root
 */
define('DOCROOT', '/');

/**
 * Path to the application directory.
 */
define('APPPATH', 'fuel/app/').DIRECTORY_SEPARATOR;

/**
 * Path to the default packages directory.
 */
define('PKGPATH', 'fuel/packages/').DIRECTORY_SEPARATOR;

/**
 * The path to the framework core.
 */
define('COREPATH', 'fuel/core/').DIRECTORY_SEPARATOR;

// Get the start time and memory for use later
defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true));
defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage());

// Boot the app
require APPPATH.'bootstrap.php';

// Generate the request, execute it and send the output.
try
{
    $response = Request::forge()->execute()->response();
}
catch (HttpNotFoundException $e)
{
    $route = array_key_exists('_404_', Router::$routes) ? Router::$routes['_404_']->translation : Config::get('routes._404_');
    if ($route)
    {
        $response = Request::forge($route)->execute()->response();
    }
    else
    {
        throw $e;
    }
}

// This will add the execution time and memory usage to the output.
// Comment this out if you don't use it.
$bm = Profiler::app_total();
$response->body(
    str_replace(
        array('{exec_time}', '{mem_usage}'),
        array(round($bm[0], 4), round($bm[1] / pow(1024, 2), 3)),
        $response->body()
    )
);

$response->send(true);

現在、パブリックは URL に含まれていませんが、サイトを開くと大量のエラーが発生します。フォワード スラッシュとバック スラッシュが挿入されているのが見えますが、実際には問題を見つけることができません。

Warning: require_once(fuel/core/classes\error.php) [function.require-once]: failed to open stream: No such file or directory in C:\EasyPHP\www\fuelphp\fuel\core\base.php on line 25

Fatal error: require_once() [function.require]: Failed opening required 'fuel/core/classes\error.php' (include_path='.;C:\php\pear') in C:\EasyPHP\www\fuelphp\fuel\core\base.php on line 25

誰かがインデックスを変更して大丈夫なようにする方法のヒントを教えてください。

ありがとうございました

4

3 に答える 3

3

試みていることを達成するために、インデックス ファイルを変更する必要はありません。

Fuel は、ドキュメント ルート (docroot) の上に存在するように設計されています。docroot は www/ のようです。

これは、ディレクトリ構造が実際には次のようになっている必要があることを意味します。

C:\EasyPHP\fuelphp\
C:\EasyPHP\www\

FuelPHP zip ファイルまたは git clone (または入手したもの) には、public. このフォルダーは、docroot の想定された名前であるため、状況によっては、の内容を次の場所public/にコピーする必要があります。www/

ただし、試みているように docroot 内ですべてを設定することができます。そのプロセスは、FuelPHP の Web サイトで文書化されています

ポイント 3 で説明したように、セキュリティ上の理由から、Web サーバーのドキュメント ルート内に Fuel をインストールしないことを強くお勧めします。

ただし、そうしたい場合もある […]

その場合、追加の .htaccess ファイルをドキュメント ルートに配置する必要があります。これにより、サイト ルートへの要求がパブリック フォルダーにリダイレクトされ、パブリック フォルダーを含めるように書き換えが変更されます。

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteBase /public

    RewriteRule ^(/)?$ index.php/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

index.php のデフォルト設定では、デフォルトで /fuel/ フォルダの位置が考慮されます。たとえば、次のパス定義を見てください。

define('COREPATH', realpath(__DIR__.'/../fuel/core/').DIRECTORY_SEPARATOR);

__DIR__    - Path of current working directory, i.e. wherever index.php is
..         - go up a directory, i.e. directory above wherever index.php is
fuel/      - Fuel folder
core/      - Core folder within fuel/

realpath() - Resolves the .. to it's real location and makes sure / is correct or changes to \ depending on the OS

さまざまな方向のスラッシュが表示される理由は/、使用せずにコードにハードコーディングしたためですrealpath()

于 2012-08-02T08:45:19.567 に答える
0

あなたのファイルで:

C:\EasyPHP\www\fuelphp\public\.htaccess

次の値を設定しRewriteBaseます。/easyphp/www/fuelphp/public

于 2017-04-19T02:48:47.083 に答える
0

また、VirtualHost を使用してhttp://project.dev/をプロジェクトのパブリック パスに誘導することもできます。

于 2012-12-29T01:15:32.323 に答える