我在Laravel中很新,我有以下问题。
我正在我的旧笔记本上开发一个Laravel 5应用程序,将我的代码放在我的GIT存储库中。然后我更换笔记本电脑,并从 GIT 签出我的 Laravel 5 项目。
然后我执行此语句以重新导入我的依赖项:
composer install
现在我的问题是我无法访问我的 Laravel 网站的已开发部分。
例如我有这个控制器类:
class RegistrationController extends Controller {
public function index(){
Log::info('index() START');
return view('/registration/index');
}
..................................................................
..................................................................
..................................................................
}
index()方法渲染resources/views/registration/index.blade.php视图。
问题是尝试打开 URL http://laravel.dev/registration我得到以下 Laravel 错误消息:
Whoops, looks like something went wrong.
Whoops, looks like something went wrong.
此外,如果我尝试访问http://laravel.dev/基本 URL,我将获得相同的错误消息。
其中laravel.dev是以这种方式在我的C:\xampp\apache\conf\extra\httpd-vhosts.conf文件中声明的虚拟主机:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName dummy-host2.example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/HotelRegistration/public"
ServerName laravel.dev
</VirtualHost>
其中C:/xampp/htdocs是我所有项目都部署在 Apache 中的位置,而C:/xampp/htdocs/HotelRegistration/public是我的 Laravel 5 项目的公共文件夹。
执行php artisan route:list语句,我获得了所有路由的列表:
C:\xampp\htdocs\HotelRegistration>php artisan route:list
+--------+-----------+----------------------------------+----------------------+-----------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+----------------------------------+----------------------+-----------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | contact | | Closure | web |
| | POST | contact | | App\Http\Controllers\EnquiryController@index | web |
| | GET|HEAD | registration | registration.index | App\Http\Controllers\RegistrationController@index | web |
| | POST | registration | registration.store | App\Http\Controllers\RegistrationController@store | web |
| | GET|HEAD | registration/create | registration.create | App\Http\Controllers\RegistrationController@create | web |
| | GET|HEAD | registration/{registration} | registration.show | App\Http\Controllers\RegistrationController@show | web |
| | PUT|PATCH | registration/{registration} | registration.update | App\Http\Controllers\RegistrationController@update | web |
| | DELETE | registration/{registration} | registration.destroy | App\Http\Controllers\RegistrationController@destroy | web |
| | GET|HEAD | registration/{registration}/edit | registration.edit | App\Http\Controllers\RegistrationController@edit | web |
+--------+-----------+----------------------------------+----------------------+-----------------------------------------------------+--------------+
其中包含:
| | GET|HEAD | registration | registration.index | App\Http\Controllers\RegistrationController@index | web |
所以看起来注册资源正确地关联到前面的控制器方法。
那么为什么我会遇到这个问题?问题是什么?我错过了什么?我该如何解决这个问题?
EDIT-1:进入laravel.log文件我发现了这个错误信息:
[2017-03-08 09:31:37] production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. in C:\xampp\htdocs\HotelRegistration\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:43
Stack trace:
#0 C:\xampp\htdocs\HotelRegistration\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(27): Illuminate\Encryption\Encrypter->__construct('', 'AES-256-CBC')
#1 C:\xampp\htdocs\HotelRegistration\vendor\laravel\framework\src\Illuminate\Container\Container.php(678): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application))
#2 C:\xampp\htdocs\HotelRegistration\vendor\laravel\framework\src\Illuminate\Container\Container.php(565): Illuminate\Container\Container->build(Object(Closure))
#3 C:\xampp\htdocs\HotelRegistration\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(702): Illuminate\Container\Container->make('encrypter')
.............................................................................
.............................................................................
.............................................................................
所以问题可能取决于我没有更多的.env文件这一事实(因为 GIT 似乎忽略了它)?