我學會了laravel
使用version 5.4
6個月。然後我安裝了最新的xampp。但是現在我得到了一個建在laravel 5.1
上的項目。但是,當我想運行應用程序,它給了我錯誤(未定義的索引:http_host)!我怎樣才能找到錯誤來自哪裏? 我該如何解決這個問題?我在網上搜索,但沒有發現富有成效。 你能幫我嗎? 存儲/ log.php:Laravel 5.1在運行'php artisan serve'時給出'未定義索引:http_host'
[2017-07-18 21:55:50] local.ERROR: ErrorException: Undefined index: HTTP_HOST in H:\Current\school\school\app\Providers\AppServiceProvider.php:40
堆棧跟蹤:
#0 H:\Current\school\school\app\Providers\AppServiceProvider.php(40): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined index...', 'H:\\Current\\scho...', 40, Array)
#1 [internal function]: Erp\Providers\AppServiceProvider->boot()
#2 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Container\Container.php(507): call_user_func_array(Array, Array)
#3 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(734): Illuminate\Container\Container->call(Array)
#4 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(717): Illuminate\Foundation\Application->bootProvider(Object(Erp\Providers\AppServiceProvider))
#5 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(Erp\Providers\AppServiceProvider), 18)
#6 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(718): array_walk(Array, Object(Closure))
#7 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php(17): Illuminate\Foundation\Application->boot()
#8 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#9 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(208): Illuminate\Foundation\Application->bootstrapWith(Array)
#10 H:\Current\school\school\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#11 H:\Current\school\school\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 {main}
AppServiceProvider:
public function boot()
{
if(!Session::get(SITE_ID)){
$subdomain_name = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
if(isset($subdomain_name) && !empty($subdomain_name)){
$domain = $subdomain_name;
}else{
$domain = "school";
}
$siteToRecollect = DB::table('site_infos')->where('site_alias',$domain)->first();
if(isset($siteToRecollect->id) && !empty($siteToRecollect->id) && $siteToRecollect->id != 0){
Session::put(SITE_ID,$siteToRecollect->id);
}else{
Session::put(SITE_ID,1);
}
}
}
40行:
$subdomain_name = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
後您的日誌,而不是自動加載,請 – vietnguyen09
我在哪裏可以找到日誌文件? – Fawel
你可以在'storage \ logs'中找到,刪除這裏的每個文件並重新運行你的artisan命令以獲取錯誤,並打開你的日誌文件並更新你的文章 – vietnguyen09