gpt4 book ai didi

php - Kohana 3 auth 模块,如何配置用户表和字段

转载 作者:可可西里 更新时间:2023-11-01 00:06:39 24 4
gpt4 key购买 nike

我在模块加载器中取消注释以加载 auth,但我不明白的是如何告诉 auth 模块它应该使用哪个表的哪些字段来进行身份验证?我也没有在 Kohana 3 的用户指南中找到它,因为我发现 auth 模块的用户指南不存在。

所以请告诉是否有人已经在使用它。如果它使用某些表的一些默认字段,那么我该如何修改它?

感谢您阅读我的问题并努力回答。

最佳答案

这是适合你的步骤

  • 取消注释 bootstrap.php 中的 Auth 模块(您已经完成了)
  • ORM Module中,是的,在ORM Module中你会发现auth-schema-mysql.sql & auth-schema- postgresql.sql。使用您需要的那个。
  • 根据需要配置配置文件auth.php。以下是我正在使用的配置。

    <?php defined('SYSPATH') or die('No direct access allowed.');
    return array(
    'driver' => 'ORM',
    'hash_method' => 'sha256',
    'hash_key' => "ica_hash_key",
    'lifetime' => Date::MINUTE * 30,
    'session_type' => 'database',
    'session_key' => 'auth_user',
    );
  • bootstrap.php 中设置 Cookie::$salt。在您的 bootstrap.php 中添加这一行。

    Cookie::$salt = 'YourSecretCookieSalt';
  • 您已完成 Auth 模块 配置;)


既然你配置了auth模块,显然你已经执行了sql脚本。您将在数据库中创建 usersrolesroles_usersusers_tokens 表。

现在您可以通过添加更多列来更改users 表。当您使用 ORM 时,Model_User 已经存在,它是一个 ORM :)

我相信这应该是全部。

关于php - Kohana 3 auth 模块,如何配置用户表和字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8019927/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com