サイトのURLがhttp://example.com とします。
デフォルトの設定では
http://example.com/home/indexへアクセスすると「home」コントローラーの
「index」メソッドが実行されます。
これが例えばhttp://example.com/adminの場合は「admin」コントローラーの
「index」メソッド、http://example.com/loginの場合は「login」コントローラーの
「index」メソッドを実行し、これ以外のURL「例:http://example.com/x1/x2」の場合は
「front」コントローラーの「index」メソッドを実行し、x1とx2は以下のような引数として扱う方法を探しています。
php
1<?php 2defined('BASEPATH') OR exit('No direct script access allowed'); 3 4class Front extends CI_Controller { 5 6 public function index($x1, $x2) 7 { 8 $args = array( 9 'x1' => $x1, 10 'x2' => $x2, 11 ); 12 $this->load->view('front/index', $args); 13 } 14} 15
何卒情報ご提供の程お願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。