Kategoria - Codeigniter 4 - liczba wpisów 2
php spark make:migration Clients
vim app/Database/2024-01-01-000000_Clients.php
php spark migrate
php spark make:model Clients_model
php spark make:controller Clients

Źródło: https://medium.com/@choirulihwan/how-to-create-crud-operation-with-codeigniter-4-and-react-js-fb54d28c923c

Codeigniter 4 - PHP 8.2 install Kategoria: Codeigniter 4 | Autor: Bartłomiej Gałęzia

aptitude install php8.2 php8.2-intl libapache2-mod-php8.2
vim /etc/apache2/apache2.conf
<Directory /home/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
vim /etc/php/8.2/cli/php.ini
extension=intl
service apache2 restart
composer create-project codeigniter4/appstarter moj_projekt

In app

vim app/Config/App.php
public string $baseURL = 'http://localhost/ci4/';

copy index.php and .htaccess from public to root

cp /home/www/ci4/public/index.php /home/www/ci4/index.php
cp /home/www/ci4/public/.htaccess /home/www/ci4/.htaccess
vim /home/www/ci4/index.php
require FCPATH . 'app/Config/Paths.php';

Routing - żeby każdy kontroler był odrazu dostępny przez URL

vim app/Config/Routes.php
$routes->setAutoRoute(true);

Base_url() z ukośnikiem na końcu

vim /system/Helpers/url_helper.php
//return rtrim(site_url($relativePath, $scheme, $config), '/');
return site_url($relativePath, $scheme, $config);

Disable debugbar:

vim app/Config/Filters.php
public array $globals = [
        'before' => [
        ],
        'after' => [
            //'toolbar',
        ],
    ];

Źródło:

https://www.tutsmake.com/codeigniter-4-remove-public-and-index-php-from-url/

https://www.studentstutorial.com/codeigniter/remove_public_index.php

https://codeigniter4.github.io/userguide/testing/debugging.html

Wyszukaj

Zapisz się do newsletera