2016-09-07 6 views
0

laravelのランディングページを示すlaravel 5とlocalhost/laravel/publicをインストールしました。一度私はコントローラのhelloをphp artisanコマンドを使用して作成し、helloコントローラのページが表示されないことを示すようなhtaccessファイルを作成しました。このエラーにlaravelコントローラからパブリックを削除した後に動作しませんか?

RewriteEngine On 
RewriteRule ^(.*)$ public/$1 [L] 

のroutes.phpファイルを解決するために私を助けてください

Route::get('/', function() { 
return view('welcome'); 
}); 


Route::get('/hello', '[email protected]'); 

hello.phpコントローラファイル

<?php 

    namespace App\Http\Controllers; 

use Illuminate\Http\Request; 

    use App\Http\Requests; 

class Hello extends Controller 
{ 
public function index() 
    { 
    echo "test"; 
    } 
} 

答えて

0

解決済み

laravel 5 urlからpublicを簡単に削除できます。あなただけされ、公開ディレクトリからのindex.phpと.htaccessをカットし、ルートディレクトリに貼り付け、すべてのthatsと

require __DIR__.'/bootstrap/autoload.php'; 
    $app = require_once __DIR__.'/bootstrap/app.php'; 
1

それは面白いですが、本当の事は公衆に依存しないコントローラでありますフォルダ。パブリックフォルダのファイルを別のディレクトリにコピーし、index.phpから他のファイルを完全に含んでいる場合は、確実に動作します。

require __DIR__.'/../bootstrap/autoload.php'; 

/* 
|-------------------------------------------------------------------------- 
| Turn On The Lights 
|-------------------------------------------------------------------------- 
| 
| We need to illuminate PHP development, so let us turn on the lights. 
| This bootstraps the framework and gets it ready for use, then it 
| will load up this application so that we can run it and send 
| the responses back to the browser and delight our users. 
| 
*/ 

$app = require_once __DIR__.'/../bootstrap/app.php'; 

index.phpに両方のファイルを完全に含めることができるように、これらの2つの行ディレクトリを変更します。

+0

としてindex.phpの中に2行を交換する必要があり、あなたが私を見ることができ、それを –

+0

回答を行う方法あなたのために更新 –

関連する問題