• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controllers does not show when i use them in URL

#1
In the Docs in this page

https://codeigniter.com/user_guide/incom...llers.html

the first example , i created the controller

PHP Code:
<?php namespace App\Controllers;

use 
CodeIgniter\Controller;

class 
Helloworld extends Controller
{
    public function index()
    {
        echo 'Hello World!';
    


then i visited this URI 

https://localhost/www/igniterTest/public/helloworld

But what is get was this

   

a 404 page

So where is the problem ? is it possible to access controllers without going through routes first ?
Increase Your Awareness
Reply

#2
Did you name your file Helloworld.php with a capital H? It won't work otherwise.

Have you disabled $routes->setAutoRoute(true); in App\Config\Routes? As it needs to be true, to automatically find it.
Reply

#3
Try
https://localhost/www/igniterTest/public/index.php/helloworld
Reply

#4
(07-16-2020, 07:18 AM)jreklund Wrote: Did you name your file Helloworld.php with a capital H? It won't work otherwise.

Have you disabled $routes->setAutoRoute(true); in App\Config\Routes? As it needs to be true, to automatically find it.

Yes its capital , the problem was in

$routes->setAutoRoute(false);


i made it

$routes->setAutoRoute(true);

thank you for help
Increase Your Awareness
Reply

#5
(07-16-2020, 12:02 PM)ChicagoPhil Wrote: Try
https://localhost/www/igniterTest/public/index.php/helloworld

The problem was in

$routes->setAutoRoute(true);

it was false , thank you
Increase Your Awareness
Reply

#6
(07-16-2020, 03:57 PM)BlackBanana Wrote:
(07-16-2020, 12:02 PM)ChicagoPhil Wrote: Try
https://localhost/www/igniterTest/public/index.php/helloworld

The problem was in

$routes->setAutoRoute(true);

it was false , thank you

That’s why the man has all those stars by his name. ?
Reply

#7
(07-16-2020, 10:20 PM)ChicagoPhil Wrote:
(07-16-2020, 03:57 PM)BlackBanana Wrote:
(07-16-2020, 12:02 PM)ChicagoPhil Wrote: Try
https://localhost/www/igniterTest/public/index.php/helloworld

The problem was in

$routes->setAutoRoute(true);

it was false , thank you

That’s why the man has all those stars by his name. ?


Yes he is an admin , of corse he has a vast experience in codeigniter, we should all help each other to give something to open source community
Increase Your Awareness
Reply

#8
Great that it all worked out. The amount of stars (and title) are based on number of posts. So if you keep on posting you will automatically get more stars and a new title.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.