5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【入門】WindowsでCodeigniter3を触ってみる 【Hello World】

Last updated at Posted at 2018-06-30

用意するもの

XAMPP
・公式ページよりダウンロード(https://www.apachefriends.org/index.html
・ダウンロード後、OKボタンをひたすら押してインストール

Codeigniter
 ・公式ページよりダウンロード(https://codeigniter.com/
)して解凍。ファイル名を【codeigniter】にする。
 ・XAMMPにあるhtdocsフォルダに【codeigniter】を配置。デフォルトのままであれば【C:\xampp\htdocs】が配置パス。
 

起動手順

1. XAMMPのコントロールパネル起動して、Apacheを起動

XAMMP.png

2. 以下のURLを入力して起動を確認

XAMMP2.png

3. Hello!Worldを書く

codeigniter内にある以下のPHPファイルを編集して、以下の箇所にHello Worldを追加
application/controllers/Welcome.php

Welcome.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		echo '<p>Hello World</p>'; // here
		$this->load->view('welcome_message');
	}
}

4. 以下の画面をリロードして確認。画面左上にHello Worldがある。

http://localhost/codeigniter
XAMMP2.png

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?