小编and*_*osh的帖子

使用CodeIgniter上传多个图像

我是在我的项目中使用代码点火器的新用户,我在上传多个文件时面临一个问题,但最后一个只插入到所有图像三个图像字段.

我的控制器是:

function products()
    {
     date_default_timezone_set("Asia/Kolkata");
     $config['upload_path'] = './resources/images/products/';
     $config['allowed_types']        = 'gif|jpg|png';
     $config['max_size']             = 1000;
     $config['max_width']            = 1024;
     $config['max_height']           = 768;
     $this->load->library('upload', $config);
     $this->upload->do_upload('userfile');
        $data = array('prod_image' => $this->upload->data(), 
             'prod_image1' => $this->upload->data(),
              'prod_image2' => $this->upload->data());
    $product_image=$data['prod_image']['file_name']; 
    $product_image1=$data['prod_image1']['file_name'];
    $product_image2=$data['prod_image2']['file_name'];

        $data = array(
                'name' => $this->input->post('pd_name'),
                'prod_image' => $product_image,
                'prod_image1' => $product_image1,
                'prod_image2' => $product_image2,
                'created_time' => date('Y-m-d H:i:s'));

        // insert form data into database
        $result_set= $this->tbl_products_model->insertUser($data);

    }       
Run Code Online (Sandbox Code Playgroud)

我的观点部分是:

<input class="form-control" name="pd_name"type="text"/>
<input type="file"  class="file_upload2" name="userfile"/> //1
<input type="file" class="file_upload2" name="userfile"/> //2 …
Run Code Online (Sandbox Code Playgroud)

php codeigniter file-upload

13
推荐指数
2
解决办法
4万
查看次数

bcryptjs 中的加密和解密

我想加密一个电子邮件 ID 并解密它如何?我检查了文档,但它只显示密码加密,并且显示的是真或假的结果。

有什么方法可以加密和解密电子邮件ID,请帮助我?

bcrypt node.js express

4
推荐指数
1
解决办法
5621
查看次数

如何在php中找到每个子集的总和?

我想计算所有可能的子集形式数组的总和。

$array= Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 6 ); //changing

function powerSet($array) {
 // add the empty set
    $results = array(array());
    foreach ($array as $element) {
        foreach ($results as $combination) {
            $results[] = array_merge(array($element), $combination);
            $total= array_sum($results); // I try this
        }
        echo $total; // I try this
    }
    return $results;
}
Run Code Online (Sandbox Code Playgroud)

上面的代码用于查找子集。我从这里找到了这段代码。我只添加array_sum但显示0的方式如何找到每个子集的总和?有什么办法吗?

php arrays math set subset

0
推荐指数
1
解决办法
64
查看次数

标签 统计

php ×2

arrays ×1

bcrypt ×1

codeigniter ×1

express ×1

file-upload ×1

math ×1

node.js ×1

set ×1

subset ×1