[英]CodeIgniter Tank Auth make user folder with him name upon registration
I found some similar question 1 year ago: Codeigniter Tank Auth add folder upon registration ... but not with username included. 我在1年前发现了一些类似的问题: Codeigniter Tank Auth注册时添加了文件夹 ...但未包含用户名。 I tried to add username (of the registered person in that moment) in module, function create_user.This function create new folder with
$user_id
and _
like: 1_
but without username of the registered person. 我试图在模块create_user。模块中添加(当时的注册人的)用户名。此函数创建带有
$user_id
和_
新文件夹,如: 1_
但没有注册人的用户名。 I tried to include data $username
from $data
array, but hoplesss... 我试图从
$data
数组中包含数据$username
,但是没钱...
if($this->db->insert($this->table_name, $data)) {
$user_id = $this->db->insert_id();
$name = $username;
if(!is_dir(FCPATH."./uploads/".$user_id."_".$name)){
mkdir(FCPATH."./uploads/".$user_id."_".$name , 0777);
}
I know that $data
array has username on 1. position for DB write purpose. 我知道
$data
数组在1.位置具有用户名以用于数据库写入。 I tried this possiblity: $name = $username; $name = $data[0];
我尝试过这种可能性:
$name = $username; $name = $data[0];
$name = $username; $name = $data[0];
I found that the library, Tank_auth.php has function get_username()
. 我发现Tank_auth.php库具有函数
get_username()
。 It is for later purpose when the new user will log in... How can I get username from $data
or DB, table users, cell username ? 新用户登录时将用于以后的用途...如何从
$data
或DB,表用户,单元用户名中获取用户名?
Try 尝试
$name = $data['username'];
in your code to get the name of the user. 在您的代码中获取用户名。
From CodeIgniter Active Record manual , $data
is an associative array which will have table field names as keys. 从CodeIgniter Active Record手册中 ,
$data
是一个关联数组,它将表字段名称作为键。
From Tank Auth it is clear that users
table contains a field with the name username
to store the user's name. 在Tank Auth中 ,很明显,
users
表包含一个名称为username
的字段,用于存储用户名。
Let me know if this helps. 让我知道是否有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.