他の人が言ったように。すべてが index.php を通過します。しかし、実際にはそれを非表示にして、URL に入力する必要がないようにすることができます。
applications/config/config.php に移動し、次のようなものを見つけます。
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";
index.php を削除します。そして、.htaccess (あなたの index.php の隣にあります) に、これを追加する必要があります:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
すべてが機能する場合は、プロファイル コントローラーを次のように呼び出すことができますhttp://localhost/php/ci/profile_control
。デフォルトでは index アクションを呼び出すのでpublic function index
、そのコントローラーに があることを確認してください。URL構造は常にhttp://url.com/*controller*/*action*/*extra params here*
たとえばpublic function profile()
、コントローラー内で別のアクション (関数) を呼び出したい場合は、この url を呼び出すことができますhttp://localhost/php/ci/profile_control/profile
。
$this->load->view('profile')で他のビュー ファイルを指定するのは、その 2 番目のアクションです。それはview/profile.phpファイルを呼び出します
この -> のようにそのアクションに値を渡すこともできますhttp://localhost/php/ci/profile_control/profile/id/7
。
あなたのプロファイルアクションでは、次のようにそれらの値を取得する必要があります
public function profile($action, $value)
{
//$action = the word id and $value = the number 7
}