0
1

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 1 year has passed since last update.

CakePHP 4.4.15 で HelloWorld

Last updated at Posted at 2021-05-17

CakePHP 4.4.15 で HelloWorld を行う方法です。

事前の準備

Arch Linux で必要なモジュールのインストール方法

sudo pacman -S php-intl
sudo pacman -S php-sqlite
/etc/php/php.ini
(省略)
extension=intl
(省略)
extension=pdo_mysql
(省略)
extension=pdo_sqlite
(省略)

プロジェクトの作成

composer create-project --prefer-dist cakephp/app hello01

サーバーの起動

cd hello01
bin/cake server

http://localhost:8765
にアクセス
image.png

プログラムの作成

mkdir templates/Hello
templates/Hello/index.php
<html>
<head>
<title>こんにちは</title>
</head>
<body>
    <h1>こんにちは</h1>
    <p>Hello World!</p>
    <p>こんにちは</p>
<p>Aug/01/2023 PM 15:00</p>
</body>
src/Controller/HelloController.php
<?php
declare(strict_types=1);

namespace App\Controller;

class HelloController extends AppController
{
  public function index()
  {
  }
}

サーバーの起動

bin/cake server

http://localhost:8765
にアクセス
image.png

確認したバージョン

$ php --version
PHP 8.2.8 (cli) (built: Jul  5 2023 18:47:24) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?