逯海峰 发表于 2016-5-9 10:58:09

cur问题

Not Found

The requested URL /cicode/mendianl was not found on this server
这种问题是为啥

逯海峰 发表于 2016-5-9 10:59:20

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mendianl extends CI_Controller
{
        protected $data = array();
       
        function __construct()
        {
                parent::__construct();
                $this->load->model(array('Musers','Msession','Mlogs','Mworkorderstep2','Mmac'));
        }
       
       
       
                       
                       
                       
/*mac地址的获取*/
var $return_array = array(); // 返回带有MAC地址的字串数组
var $mac_addr;

function GetMacAddr($os_type = 'PHP_OS'){
       switch ( strtolower($os_type) ){
                          case "linux":
                                                $this->forLinux();
                                                break;
                          case "solaris":
                                                break;
                          case "unix":
                                               break;
                           case "aix":
                                               break;
                           default:
                                               $this->forWindows();
                                               break;

          }

               
          $temp_array = array();
          foreach ( $this->return_array as $value ){

                                if (
preg_match("/[:-]"."[:-]"."[:-]"."[:-]"."[:-]"."/i",$value,
$temp_array ) ){
                                               $this->mac_addr = $temp_array;
                                               break;
                           }

          }
          unset($temp_array);
          return $this->mac_addr;
}


function forWindows(){
          @exec("ipconfig /all", $this->return_array);
          if ( $this->return_array )
                           return $this->return_array;
          else{
                           $ipconfig = $_SERVER["WINDIR"]."\system32\ipconfig.exe";
                           if ( is_file($ipconfig) )
                                  @exec($ipconfig." /all", $this->return_array);
                           else
                                  @exec($_SERVER["WINDIR"]."\system\ipconfig.exe /all", $this->return_array);
                           return $this->return_array;
          }
}



function forLinux(){
          @exec("ifconfig -a", $this->return_array);
          return $this->return_array;
}
/*mac地址的获取*/
       
       
       
       
       
        function index()
        {
               
//                 $this->db->query('alter   table   logs   drop   column   id');
//                 $this->db->query('alter   table   logs   add   id   int   identity(1,1)');
//                 $this->db->query('alter table indent_detail_item add REALPRICE float');
//                 $this->db->query('alter table product add realprice varchar(10)');
//                 $this->db->query('update product set realprice=price');
//                 exit;

//                 var_dump($this->db->get('SYSC_WORKORDERSTEPSTATUS')->result_array());

                $this->check_login();
                $this->data['result'] = "";

                $username = $this->input->post("username",true);
                $password = $this->input->post("password",true);
               
                $mac_addr = $this->GetMacAddr($os_type = 'PHP_OS');
               
                if($username!=''){
                        $re_mac = $this->Mmac->get_row(array('name'=>$username));
                        if(count($re_mac)==0){
                                $mac_arr = array(
                                        'name' => $username,
                                        'mac' => $mac_addr
                                );
                               
                                $this->Mmac->insert($mac_arr);
                        }
                }
               
               
                if ($_POST)
                {
                        $this->data['result'] = "error";
                }
                if ($username and $password)
                {
                        //查询用户信息
                        $this->data['result'] = $this->Musers->get_row(array('username'=>$username,"password"=>md5(md5($password))));
                       
                        if(!empty($this->data['result']) && empty($this->data['session']['user_data']) && time()-$this->data['session']['last_activity']>config_item('sess_expiration'))
                        {
                                $arr = array(
                                        "id" =>$this->data['result']['id'],
                                        "username"=>$this->data['result']['username'],
                                        "name"=>$this->data['result']['name']
                                );print_r($arr);
                                $this->session->set_userdata('user',$arr);
                               
                                $this->Mlogs->insert(array('userid'=>$this->data['result']['id'],
                                        'optype'=>1,
                                        'opmoudle'=>1,
                                        'opcontent'=>'用户ID:'.$arr['id'].' 用户名:'.$arr['username'].' 真实姓名:'.$arr['name'].'成功登陆 登陆IP为:'.getonlineip(),
                                        'opdate'=>nowdate(),
                                ));
                                $this->log->write_log('INFO',"userid:".$arr." username:".$arr." IP: ".getonlineip()." logined.");
                                redirect(site_url());
                        }else
                        {
                                if(empty($this->data['result'])){
                                        $this->data['result'] = "error";
                                }
                        }
                }
                $this->load->view('login',$this->data);
        }
       
        //检测是否登录
        function check_login()
        {
                if ($this->session->userdata('user'))
                {
                        redirect(site_url());
          }
        }
       
        //退出登录
        function quit()
        {
                $user=$this->session->userdata('user');
               
                $this->Mlogs->insert(array('userid'=>$user['id'],
                                'opmoudle'=>1,
                                'optype'=>2,
                                'opcontent'=>'退出',
                                'opdate'=>nowdate(),
                ));
               
                $this->log->write_log('INFO',"userid:".$user." username:".$user." logouted.");
               
                $this->session->unset_userdata('user');
                redirect(site_url("mendianl"));
        }
       
}

逯海峰 发表于 2016-5-9 11:00:01

为啥我想显示mendianl无显示

逯海峰 发表于 2016-5-9 11:00:16

http://localhost/cicode/mendianl

Hex 发表于 2016-5-9 12:45:23

是否配置好 nginx 了?

逯海峰 发表于 2016-5-9 13:39:23

Hex 发表于 2016-5-9 12:45
是否配置好 nginx 了?

我配置的是apache
用的是wamp2.0版本
CI版本是2.0.1、
现在就是后台登录界面显示
然后就是跳转处一片空白

逯海峰 发表于 2016-5-9 13:39:58

Hex 发表于 2016-5-9 12:45
是否配置好 nginx 了?

数据库是SqlServer2005我开启了mssql扩展

Hex 发表于 2016-5-9 14:17:45

逯海峰 发表于 2016-5-9 13:39
我配置的是apache
用的是wamp2.0版本
CI版本是2.0.1、


空白页是 PHP 报错了,要把 PHP 错误信息显示出来才能知道是什么问题。

逯海峰 发表于 2016-5-9 17:55:55

Hex 发表于 2016-5-9 14:17
空白页是 PHP 报错了,要把 PHP 错误信息显示出来才能知道是什么问题。

请问用啥方法CI框架内部有封装的方法没
还有用echo var_dump()吗?

逯海峰 发表于 2016-5-9 18:06:14

Hex 发表于 2016-5-9 14:17
空白页是 PHP 报错了,要把 PHP 错误信息显示出来才能知道是什么问题。

他这种错误需要怎样解决啊
页: [1] 2
查看完整版本: cur问题