codeigniter 경로 지원 은 물음표 가 있 는 재 작성 만 처리 할 수 있 습 니 다!
11278 단어 codeigniter
파일 수정: system / core / Router. php 방법:
_parse_routes() :
//2014-11-16 12:19 add by f.z.b
if(strpos($val,'?') !== false){
list($val,$queryString) = explode('?',$val);
parse_str($queryString,$_GET);
}
전체 방법의 코드:
function _parse_routes()
{
// Turn the segment array into a URI string
$uri = implode('/', $this->uri->segments);
// Is there a literal match? If so we're done
if (isset($this->routes[$uri]))
{
return $this->_set_request(explode('/', $this->routes[$uri]));
}
// Loop through the route array looking for wild-cards
foreach ($this->routes as $key => $val)
{
// Convert wild-cards to RegEx
$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
// Does the RegEx match?
if (preg_match('#^'.$key.'$#', $uri))
{
// Do we have a back-reference?
if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE)
{
$val = preg_replace('#^'.$key.'$#', $val, $uri);
}
//2014-11-16 12:19 add by f.z.b
if(strpos($val,'?') !== false){
list($val,$queryString) = explode('?',$val);
parse_str($queryString,$_GET);
}
return $this->_set_request(explode('/', $val));
}
}
// If we got this far it means we didn't encounter a
// matching route so we'll set the site default route
$this->_set_request($this->uri->segments);
}
설정 경로: application / config / routes. php
$route['info/cat-(:num)-(:num)-(:num)'] = 'info/lst/1?type=cat&v1=$1&v2=$2&v3=$3';
public function lst($page = 1)
{
if ($page < 1) $page = 1;
$type = $this->input->get('type');
if($type == 'diqu'){
$v1 = $this->input->get('v1');
$v2 = $this->input->get('v2');
$v3 = $this->input->get('v3');
} else {
}
}
\ # 문 기본 값 입 니 다[email protected]
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
php 프레임워크codeigniter에서 프레임워크를 어떻게 사용하는지session 분석session 데이터가 데이터베이스에서 사용할 수 있을 때 사용자 쿠키에서 유효한 session을 발견할 때마다 데이터베이스 조회가 실행됩니다.세션 ID가 맞지 않으면 세션이 제거됩니다.Session ID는 새 세션...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.