简体   繁体   English

Hash :: make无法正常工作route.php文件

[英]Hash::make not working route.php file

I'm having auth problems in my new laravel 4 app. 我在新的laravel 4应用中遇到身份验证问题。 The one odd thing I have noticed and this might be why is that when I do: 我注意到了一件奇怪的事情,这可能就是为什么当我这样做时:

var_dump(Hash::check('secret', Hash::make('secret')));

in the DB seeder (where I create my hashed passwords) I get true. 在数据库播种机(在其中创建哈希密码的地方)中,我得到了真。

When I run that same command directly in a route, I get false. 当我直接在路由中运行同一命令时,我得到了错误。

Also, when I do a simple: 另外,当我做一个简单的:

var_dump(Hash::make('secret'));

directly in the route it is still false. 直接在路线上仍然是错误的。

Is this broken or am I missing something ? 这是坏了还是我错过了什么?

There is something wrong with your install. 您的安装有问题。 This is what I get: 这是我得到的:

Route::get('/', function()
{
    var_dump(Hash::make('secret'));  // Gives a bcrypt string output
    var_dump(Hash::check('secret', Hash::make('secret'))); // Output true
}

Did you do a composer update, and forget to update the app itself? 您是否进行过作曲家更新,而忘记更新应用程序本身? That is the most common cause of Laravel 4 issues at the moment. 这是当前Laravel 4问题的最常见原因。

This forum pos t gives a detailed answer on how to update the main L4 app after a composer update. 本论坛将详细介绍如何在作曲家更新后更新主L4应用程序。

Edit: I will post the forum stuff here - because you need to be logged in to Laravel forums to see beta section: 编辑:我将在此处发布论坛内容-因为您需要登录Laravel论坛才能查看beta版:

If you run composer update and experience problems after doing so, you most likely need to merge in changes from the application skeleton, which is the develop branch of laravel/laravel. 如果您运行作曲家更新后又遇到问题,则很可能需要合并应用程序框架(laravel / laravel的develop分支)中的更改。

If you originally cloned this repository and still share a git history with it, you can usually merge in changes easily. 如果您最初克隆了此存储库,但仍与它共享git历史记录,则通常可以轻松合并更改。 Assuming your remote is 'upstream' pointed at this repository, you can do the following: 假设您的远程指向该存储库的“上游”,则可以执行以下操作:

git fetch upstream
git merge upstream/develop 

Alternatively you could cherry pick in individual commits from the develop branch, but I won't cover that here. 另外,您可以从develop分支中挑选单个提交,但在此不做介绍。

If you downloaded the zip distribution originally or removed the upstream history, you can still resolve your problem manually. 如果您最初下载了zip发行版或删除了上游历史记录,则仍然可以手动解决问题。 Look at the commits on this branch and make any changes not present in your application. 查看该分支上的提交,并进行应用程序中不存在的任何更改。 Usually the breaking changes are simple configuration changes. 通常,重大更改是简单的配置更改。

Once Laravel 4 stable has been released the need to do this will be much less frequent, but these changes can still occur. Laravel 4稳定版发布后,执行此操作的频率将大大降低,但是这些更改仍然可能发生。 Keep in mind that during this beta application breaking changes are very likely to happen. 请记住,在此Beta版应用程序中,极有可能发生重大更改。

Thanks to Kindari for the forum post. 感谢Kindari的论坛帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM