zoukankan      html  css  js  c++  java
  • ci的url操作

    去除index.php

    wamp: httpd-vhost.conf
    <VirtualHost *:80> ServerName localhost ServerAlias localhost #DocumentRoot "${INSTALL_DIR}/www" #<Directory "${INSTALL_DIR}/www/"> DocumentRoot "C:JabinDocphp_www" <Directory "C:JabinDocphp_www"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost> <VirtualHost *:80> ServerName php.test.com ServerAlias php.test.com DocumentRoot "C:JabinDocphp_wwwci" <Directory "C:JabinDocphp_wwwci"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost>

    ci: 根目录下.htaccess
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

    url配置:

    #开启字符串查询,与默认方式不能同用,eg:index.php?c=products&m=view&id=345
    $config['enable_query_strings'] = FALSE;
    $config['controller_trigger'] = 'c';
    $config['function_trigger'] = 'm';
    $config['directory_trigger'] = 'd'; //控制器所在子目录名称
    url: http://php.test.com/index.php?c=welcome&m=view&d=aa&id=9 默认方式为:http://php.test.com/aa/welcome/view/8 $config['url_suffix'] = '.html'; #添加后缀,eg: http://php.test.com/welcome/view/8.html

    开启enable_query_strings后参数获取:

    url: http://php.test.com/index.php?c=welcome&m=view&id=9
    获取:$this->input->get('id')/$_GET['id']

    默认方式:

    url: http://php.test.com/welcome/view/8
    获取参数:
    public function view($id=NULL)
        {
            echo $id;exit;
            $data['id'] = $id;
            $this->load->view('view_test',$data);
        }

     

  • 相关阅读:
    elk 分布式数据同步
    mget 同时获取
    Jzoj1460 无题noname
    Jzoj1460 无题noname
    Jzoj1322硬币
    Jzoj1322硬币
    Jzoj1321 灯
    Jzoj1321 灯
    Jzoj1310 生日礼物
    Jzoj1310 生日礼物
  • 原文地址:https://www.cnblogs.com/maoriaty/p/9058599.html
Copyright © 2011-2022 走看看