注册时Codeigniter Tank Auth添加文件夹 [英] Codeigniter Tank Auth add folder upon registration

查看:67
本文介绍了注册时Codeigniter Tank Auth添加文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了Tank Auth,并试图在用户注册时创建一个文件夹.我已经像在users.php模型中编辑了create_user()函数,但是没有创建该文件夹.我在Windows 7上,所以我认为这可能是允许的事情.我关闭了UAC,但仍然无法正常工作.

I have downloaded Tank Auth and am trying to create a folder when the user registers. I have edited the create_user() function in the users.php model like so but the folder does not get created. I am on Windows 7 so I thought maybe it was a permission thing. I turned off UAC, but it still does not work.

我希望该文件夹以index.php所在的根目录结尾(在应用程序文件夹之外).

I want the folder to end up it the root directory where the index.php is (outside of application folder).

function create_user($data, $activated = TRUE)
    {
        $data['created'] = date('Y-m-d H:i:s');
        $data['activated'] = $activated ? 1 : 0;

        if ($this->db->insert($this->table_name, $data)) {
            $user_id = $this->db->insert_id();
            if(!is_dir("./uploads/".$user_id)){
                mkdir("./uploads/".$user_id , 0777);
            }

            if ($activated) $this->create_profile($user_id);
            return array('user_id' => $user_id);
        }
        return NULL;
    }

推荐答案

您的问题是目录与index.php不相关-它对于index.php必须是绝对的

Your problem is the directory is not relative to index.php - it needs to be absolute to index.php

更改

 if(!is_dir("./uploads/".$user_id)){
            mkdir("./uploads/".$user_id , 0777);

收件人

if(!is_dir(FCPATH.$user_id)){
            mkdir(FCPATH.$user_id , 0777);

这篇关于注册时Codeigniter Tank Auth添加文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆