0
나는 웹 기반 CodeIgniter의를 만들려고 해요,하지만 내 웹 사이트, 나는 온라인
이 내 htaccess로 파일을 넣을 때이 문제를 발견
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
그리고 이것은 내 설정이다 :
$config['uri_protocol'] = 'PATH_INFO';
그리고이 내 R outes.php
$default_controller = "Front";
$controller_exceptions = array('owner');
$route['default_controller'] = $default_controller;
$route["^((?!\b".implode('\b|\b', $controller_exceptions)."\b).*)$"] = $default_controller.'/$1';
$route['404_override'] = '';
그리고 이것은 내 컨트롤러 클래스 :
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Front extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function _remap($segment_1)
{
$segment_1 = $this->uri->segment(1);
switch ($segment_1)
{
case null:
case false:
case '':
$this->load->library('Facebook_ion_auth');
if (isset($_GET['code']))
{
$this->facebook_ion_auth->login();
if (!$this->ion_auth->logged_in()){
$this->index();
}else{
$succses='Selamat datang! <b>'.$this->ion_auth->user()->row()->user_display_name.'</b>';
$content = new Content();
$content->profil($succses,'');
}
}else{
$url = $this->uri->segment_array();
print_r($url);
}
break;
case 'category':
$this->category();
break;
case 'search':
$content = new Content();
$content->search();
break;
case 'pesan':
$content = new Content();
$content->pesan();
break;
case 'daftar':
$content = new Content();
$content->daftar();
break;
case 'login':
$content = new Content();
$content->login();
break;
case 'keluar':
$content = new Content();
$content->keluar();
break;
case 'profil':
$content = new Content();
$content->profil();
break;
case 'kirimpesan':
$content = new Content();
$content->kirimpesan();
break;
case 'contact':
$content = new Content();
$content->contact();
break;
case 'testimoni':
$content = new Content();
$content->testimoni();
break;
case 'facebook':
$this->load->library('Facebook_ion_auth');
$this->facebook_ion_auth->login();
break;
case 'img':
$this->img();
break;
default:
$content = new Content();
$content->sigle();
break;
}
}
public function index()
{
$content = new Content();
$content->home();
}
}
그러나 항상이 증명 것을 경우 = ""를 실행하는 $ segment_1 = $ this- > uri-> segment (1);을 (를) 찾을 수 없습니다. 또는 URI (1)에서 데이터가
$url = $this->uri->segment_array();
print_r($url);
표시합니다 , 고정 URL을 주문하는 방법 를 검출 할 수 EMPTY 표시하지. 또는 URL에서 매개 변수를 가져 옵니까 ??
Codeigniter URL 클래스에 대한 설명서도 확인하십시오. https://ellislab.com/codeigniter/user-guide/libraries/uri.html – Mhisham
: // site/== site/Front /이 코드를 다시 작성하십시오. 주셔서 감사합니다. , 나는 방금 튜토리얼을 여기에서 시도했다 -> http://www.web-and-development.com/codeigniter-remove-index-php-minimize-url/, localhost에서 작동하지만 온라인 상태 일 때는 작동하지 않는다. –
Ok try 이것이 효과가 있는지 없는지 $ this-> uri-> rsegment (1); – Mhisham