标签: codeigniter

在通过PECL安装后,OA不被PHP接收

我需要将Oauth设置为我将要开发的PHP项目的一部分.

为此,我跑了;

sudo pecl install oauth
Run Code Online (Sandbox Code Playgroud)

这完成了OK,它指示我添加extension=oauth.so到我的php.ini文件中,我做了.

然后我重新启动Apache并运行

php -i | grep oauth
Run Code Online (Sandbox Code Playgroud)

要查看它是否被PHP拾取,它似乎就像我得到的结果一样;

source version => $Id: oauth.c 325799 2012-05-24 21:07:51Z jawed $
Run Code Online (Sandbox Code Playgroud)

但是当我运行(CodeIgniter)应用程序时,我得到错误;

Fatal error: Class 'Oauth' not found in...
Run Code Online (Sandbox Code Playgroud)

我错过了一个至关重要的步骤吗?

php codeigniter oauth pecl

5
推荐指数
1
解决办法
529
查看次数

CodeIgniter insert_batch()

好吧,我试图弄清楚如何使用insert_batch

我正在尝试这样的事情

function checkboxes($data,$category)
    {

        $insert=array(
                        'story'=>$data
                        'category'=>$category
                     );

        $this->db->insert_batch('stories_to_categories',$insert);
    }
Run Code Online (Sandbox Code Playgroud)

对于$ data我有数组,可以有值和键的范围

(
    [0] => 1
    [1] => 6
    [2] => 14
    [3] => 15
    [4] => 18
)
Run Code Online (Sandbox Code Playgroud)

对于类别,我将只有一个值,例如2

我尝试达到我的习惯

  story category
------------------------
    1        2
    6        2
    14       2
    15       2
    18       2
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我,我很痛苦!

php codeigniter

5
推荐指数
1
解决办法
3万
查看次数

如何在codeigniter中使用ajax上传图像?

我正在尝试使用jQuery和ajax函数上传图像,如何获取图像文件的所有细节,就像我们使用的php一样 $_FILE()

这是我的代码

JS

$("#uploadimg" ).click(function() {
     $( "#file" ).click();
});

$( "#file" ).change(function(e) {
    var file=$('#file').val();
    alert(file);
    die();
    e.preventDefault();
    $.ajax({
        url:'http://localhost/JSG/blog/uploadimg',
        secureuri:false,
        type: "POST",
        fileElementId:'image',
        dataType: 'text',
        data:{ file: file },
        cache: true,
        success: function (data){
            alert(data);
            console.log(data);
        },
    });
});
Run Code Online (Sandbox Code Playgroud)

调节器

public function uploadimg()
{
    $var = $_POST['file'];
    print_r($var);
    if($this->input->post('file')) {
        $config['upload_path'] = 'upload'; 
        $config['file_name'] = $var;
        $config['overwrite'] = 'TRUE';
        $config["allowed_types"] = 'jpg|jpeg|png|gif';
        $config["max_size"] = '1024';
        $config["max_width"] = '400';
        $config["max_height"] = '400';
        $this->load->library('upload', $config);

        if(!$this->upload->do_upload()) {
            $this->data['error'] = …
Run Code Online (Sandbox Code Playgroud)

php ajax jquery codeigniter

5
推荐指数
1
解决办法
3万
查看次数

编码函数的codeigniter中的is_unique

我有要求,我可以在新的添加功能中进行唯一值的验证

$this->form_validation->set_rules('email','Email','required|valid_email||is_unique[users.Email]');
Run Code Online (Sandbox Code Playgroud)

它的工作,但在编辑功能,它不工作..我有写回调函数来检查唯一的电子邮件.这是我在编辑功能中编写的代码

$this->form_validation->set_rules('email','Email','required|valid_email|callback_check_email');

function check_username($email)
    { 
        $return_value = $this->user_model->check_email($email);
        if ($return_value)
        {
            $this->form_validation->set_message('email_check', 'Sorry, This username is already used by another user please select another one');
            return FALSE;
        }
        else
        {
        return TRUE;
        }
    }
Run Code Online (Sandbox Code Playgroud)

和user_model

function check_mail($email)
    { 
        $sql = "SELECT users.Email
                FROM users
                WHERE 
                $email = users.Email
                ";

        $result = $this->db->query($sql)->result_array();
        return $result;

    }
Run Code Online (Sandbox Code Playgroud)

我无法验证唯一的电子邮件

php sql codeigniter

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

如何动态地使用codeigniter和mysql制作树结构

我想使用codeigniter和mysql动态创建动态树菜单,我对css和jquery的树结构没有任何问题.

我有两个表,表组织和组织类:

(id,    parent_org_id, org_class_id, title)
(1,     0,             1,            Company Name)
(2,     0,             1,            Company2 Name)
(3,     1,             2,            Departement Name)
(4,     2,             2,            Departement2 Name)
(5,     4,             3,            Division2 Name)

(id,       org_class_title, order_no)
(1,        0,               1)
(2,        0,               2)
(3,        1,               3)
Run Code Online (Sandbox Code Playgroud)

这是我的功能:

$str ='';
$lastListLevel=0;
$firstRow=true;

foreach($organization->result() as $row){
    $currentListLevel=$row->parent_organization_id -1 ; // minus one to correct level to Level 0
    $differenceLevel=$currentListLevel-$lastListLevel;

    $rootLevel=false;

    if($differenceLevel==0){        
        if($firstRow){
            $firstRow=false;
        }else{
            $str .='</li>';
        }
        $str .='<li>';
    }elseif($differenceLevel>0){    
        for($j=0;$j<$differenceLevel;$j++){
            $str .='<ul><li>';
        }
    }elseif($differenceLevel<0){ …
Run Code Online (Sandbox Code Playgroud)

php mysql codeigniter

5
推荐指数
1
解决办法
4144
查看次数

Javascript在html中复制div并从表单提交中获取重复div的值

在我的codeigniter视图中,我有一个包含选择框和文本框的div.还有一个"添加更多"按钮.我的任务是在单击添加更多按钮时复制整个div,当我提交表单时,我需要从原始div和重复div获取字段值.我怎么能做到这一点?我尝试使用jquery clone方法复制div .但找不到解决方案.

这是我到目前为止尝试的代码:

    <?php echo form_open("vehicle/addparts");?>
    <div class="row" id="addparts">
    <div class="col-md-6">
    <div class="form-group">
    <select class="form-control input-medium" name="parts">
    <option value="">select disabled>Select Parts</option>
    <option value="a">A</option>
    <option value="b">B</option>
    <option value="c">C</option>
    </select>
    </div>
    </div>
    <div class="col-md-6">
    <div class="form-group">
    <label class="control-label">Quantity</label>
    <input type="text" name="partsquantity" id="partsquantity">
    </div>
    </div>
    </div>
    <div class="row">
    <input type="button" name="addmore" value="Add More" onClick="duplicate">
    </div>
    <?php echo form_close();?>
Javascript:

    <script>
    function duplicate() {    
    var original = document.getElementById('addparts');
    var clone = original.cloneNode(true);
    clone.id = "duplic";
    document.bodey.append(clone);
    }
    </script>
Run Code Online (Sandbox Code Playgroud)

javascript jquery codeigniter

5
推荐指数
1
解决办法
3061
查看次数

Codeigniter登录系统,带有会话,如果密码正确,可将用户重定向到页面

我创建了一个登录系统,但是每次我设置一个if语句时,当我输入正确的密码时,它都会循环回到登录页面。我需要控制器中的index函数,list_employee函数和View_employee函数,以在用户直接访问登录页面时将其重定向到登录页面,但如果他们输入正确的密码,则可以转到该页面。

user_authentication控制器

<?php

session_start(); //we need to start session in order to access it through CI

Class User_Authentication extends CI_Controller {

public function __construct() {
parent::__construct();

// Load form helper library
$this->load->helper('form');

// Load form validation library
$this->load->library('form_validation');

// Load session library
$this->load->library('session');

// Load database
$this->load->model('login_database');

}

// Show login page
public function user_login_show() {
$this->load->view('login_form');
}

// Show registration page
public function user_registration_show() {
$this->load->view('registration_form');
}

// Validate and store registration data in database
public function new_user_registration() { …
Run Code Online (Sandbox Code Playgroud)

php sql-server codeigniter

5
推荐指数
1
解决办法
5万
查看次数

codeigniter应用程序在新应用程序中查看文件夹位置问题

Your view folder path does not appear to be set correctly. Please open the following file and correct this: index.php我收到这个错误,我不知道有什么问题,我从官方网站下载了rc3(发布候选人3),解压缩它,添加了资产文件夹和帮助,当我运行应用程序时,我收到了错误Your view folder path does not appear to be set correctly. Please open the following file and correct this: index.php,这是我的index.php文件代码,图像显示了文件夹结构

// index.php code
<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
 *
 * This content is released under the MIT License (MIT)
 *
 * Copyright (c) 2014 - 2015, British …
Run Code Online (Sandbox Code Playgroud)

php codeigniter codeigniter-3

5
推荐指数
1
解决办法
1万
查看次数

set_value不适用于Codeigniter上的输入类型文件

我正在为我的项目使用HMVC Codeigniter模式.在我的项目中,我需要在表单上设置值,其中输入类型的字段是file.So,我觉得很有帮助我解决这个问题的人.

我的控制器是test.php

<?php
class Test extends Controller{
function __construct(){
        parent::__construct();  

    }
function index(){

redirect('test/form');


}
  function form(){
        $this->load->library('form_validation');
        $this->load->helper('url');
        $this->form_validation->set_rules('fname','First Name','required|trim');
        $this->form_validation->set_rules('mname','Middle Name','required|trim');
        $this->form_validation->set_rules('lname','Last Name','required|trim');


        if (empty($_FILES['userfile']['name']))
        {
            $this->form_validation->set_rules('userfile', 'Attach Your File', 'required');
        }
        if($this->form_validation->run($this)){

                    $_SESSION['msg']="Your form has been submitted succesfully!!";
                    redirect('test/form');
                }
                else
                {

                    $_SESSION['err']="Opp! There was some wrong to fill up a form so try again!!!";
                    redirect('test/form');


                }

            }
        $data['pgtitle']='Test';       
        $this->load->view('test',$data);
        } 
}
Run Code Online (Sandbox Code Playgroud)

我的视图文件是test.php

<form action="<?php echo site_url()?>test/form" method="post" enctype="multipart/form-data" onsubmit="return confirm('Do you really want to submit …
Run Code Online (Sandbox Code Playgroud)

php codeigniter

5
推荐指数
1
解决办法
3705
查看次数

如何使用dbforge [codeigniter]添加外键

我正在使用codeigniter而我正在尝试将以下查询转换为dbforge样式查询,我该怎么办?

create table filter (
    filterid int primary key auto_increment,
    filtername varchar(50) not null,
    categoryid int not null,
    isactive tinyint not null,
    sequence int not null,
    foreign key(categoryid) references category(id));
Run Code Online (Sandbox Code Playgroud)

php mysql codeigniter

5
推荐指数
2
解决办法
6115
查看次数

标签 统计

codeigniter ×10

php ×9

jquery ×2

mysql ×2

ajax ×1

codeigniter-3 ×1

javascript ×1

oauth ×1

pecl ×1

sql ×1

sql-server ×1