#07 Controllers in CodeIgniter 4

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 62

  • @anti-bug
    @anti-bug Год назад +11

    To solve the 404 error.. Follow the steps :-
    1. Go to app folder
    2. then go to config folder
    3. then open Routes.php file
    4. set ' $routes->setAutoRoute(true); '
    Hope it's help❤

  • @dhruvrajsinhjadeja-vfxarti3085
    @dhruvrajsinhjadeja-vfxarti3085 2 года назад +2

    Sir your method of teaching is just awesome. Thanks for this series :)

  • @manishasalunke1446
    @manishasalunke1446 2 года назад +2

    getting error 404 file not found : Can't find a route for 'get: /test'. test is controller name

  • @bytetronics6431
    @bytetronics6431 Год назад +2

    Please note everyone: This tutorial is not applicable for new version of codeigniter4. such as version 4.3.6. Lot of things have changed. You need to add every controller to route.php file in order to view the page in the browser. If you need an updated tutorial, I will create and upload for you. Please let me know in the comment reply section. Thank you

  • @avishekdas4947
    @avishekdas4947 2 года назад +3

    I received following error---
    404 - File Not Found
    Can't find a route for 'get: welcome'. Can you help me?

  • @suryakantingle8689
    @suryakantingle8689 2 года назад +3

    While accessing Controller File it showing 404 file not found error Pls provide solution on it

  • @siddharth_ingale
    @siddharth_ingale 2 года назад +4

    I'm getting an error. Can anyone help?
    "404 - File Not Found
    Sorry! Cannot seem to find the page you were looking for." 🤔

  • @MyPocketBeauty
    @MyPocketBeauty Год назад

    You explained very well.

  • @akhilantony1520
    @akhilantony1520 9 месяцев назад

    when i pass argument in parameter $name its not work in my case

  • @kuntoajibukanpenyanyi
    @kuntoajibukanpenyanyi Год назад

    Just wondering how come BaseController may breaks the controller naming rule itself ?

  • @jomaraggabao7877
    @jomaraggabao7877 11 месяцев назад +1

    in latest ci4, it will show a 404 message when you run it. Simply add this line to your Routes.php
    Hope this help.
    $routes->get('welcome', 'Welcome::index');

  • @compScientizt
    @compScientizt Год назад

    THANK YOU SO MUCH SIR, YOU ARE AWESOME...

  • @vipinpatel7604
    @vipinpatel7604 2 года назад +1

    not working
    404 - file not found
    Sorry! Cannot seem to find the page you were looking for.

    • @shubhampol2143
      @shubhampol2143 2 года назад

      Same problem bro

    • @shubhampol2143
      @shubhampol2143 2 года назад +1

      Did you find any new solution ? Please let me know

    • @vipinpatel7604
      @vipinpatel7604 2 года назад +2

      I got this error because i didn't set the route.

    • @shubhampol2143
      @shubhampol2143 2 года назад

      @@vipinpatel7604 ok

    • @ankitdavda1758
      @ankitdavda1758 2 года назад +5

      in routes.php write
      $routes->setAutoRoute(true);
      after
      $routes->set404Override();

  • @lateshpatel6099
    @lateshpatel6099 2 года назад

    hello, sir when I do call the controller in the same process but not work through error 404.

  • @online-game-show
    @online-game-show 2 года назад

    When i run this code i got an error, after defining path in route file my code works.

  • @afreenansari1207
    @afreenansari1207 2 года назад

    It is throwing error 404 - file not found. Please tell the solution.

    • @aniketgautam7615
      @aniketgautam7615 2 года назад

      same problem ..did you find any solution?

    • @afreenansari1207
      @afreenansari1207 2 года назад +1

      @@aniketgautam7615 if you are working on composer intalled app...
      1) rename the env file to .env and in that uncommemt "Environment= production" And change it to development
      2) go to app/Config/Routes.php and do routing there... $routes->get('about', 'Home::about') ; ... for about view.
      Suggestion: start with CI4 documentation. Follow that until "newsapp" Is completed.

  • @theschoolkid6553
    @theschoolkid6553 4 года назад

    Brother You recommended myci4 which is having vendor. github folder too, and using mannual ci4 project Folder ?

    • @GoPHP
      @GoPHP  4 года назад +1

      We can use anyone
      But recommended is composer installation

  • @akmalkh
    @akmalkh 3 года назад

    I can not load my codeigniter homepage or other controllers after setting controllers in app/controller folder. I received the following error after loading localhost. It was working the other days.
    .....................
    Access forbidden!
    You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
    If you think this is a server error, please contact the webmaster.
    Error 403
    localhost
    Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.5

    • @GoPHP
      @GoPHP  3 года назад

      can you tell me, How you are loading your project in browser URL
      I mean are you loading like below
      localhost/project-folder/controller-name
      or
      are you using any URL format?

    • @akmalkh
      @akmalkh 3 года назад

      @@GoPHP ​ It was working fine until yesterday. The page was loading everything was working I'm following ur videos. Even if I load using localhost alone to check the codeignetor msg it doesn't work or even if I use localhost/controller name or localhost/project foldername/ controller name. In all of this case the above error appears. But when I load xampp server and click on admin on apache server side the codeignitor welcome message appears.

  • @ShubhamSharma-to5po
    @ShubhamSharma-to5po 4 года назад

    bro where did you make all the changes . inside VENDER or in the root .

  • @cashinprayersessions9907
    @cashinprayersessions9907 Год назад +1

    i am requesting for these slides so i can read through at my pace. otherwise thank you for this good work

    • @GoPHP
      @GoPHP  Год назад +1

      docs.google.com/presentation/d/1Hwi1-Ays_n8iMfCOIQEhdQCk-7Co2bto/edit?usp=sharing&ouid=114060942945316235553&rtpof=true&sd=true

    • @compScientizt
      @compScientizt Год назад

      @@GoPHP THANK YOU SO MUCH

  • @BalaKondaReddyVanipenta
    @BalaKondaReddyVanipenta 2 года назад

    hii bro gud evening
    1)

    • @soumyapratimbanerjee5878
      @soumyapratimbanerjee5878 2 года назад +1

      Add a new route $routes->get('welcome', 'Welcome::index');

    • @psychodepth4636
      @psychodepth4636 Год назад

      @@soumyapratimbanerjee5878 bro help, it says 404 - Page Not Found Sorry! Cannot seem to find the page you were looking for. Im done doing this ($routes->get('welcome', 'Welcome::index'); or this ($routes->setAutoRoute(true);) nothings happens. pls help

  • @abhishekbose1705
    @abhishekbose1705 9 месяцев назад

    7:00

  • @storytime_adventures_lsp
    @storytime_adventures_lsp 3 года назад

    good explained

  • @aaniqchagani5844
    @aaniqchagani5844 4 года назад

    bro why did you no extends by BaseController

    • @chaitanyabhallamudi7204
      @chaitanyabhallamudi7204 4 года назад

      that base controller extended in the home controller, already extends the "Controller" class. And the Home.php controller just extended the BaseController. This baseController is used for auto loading required helpers or libraries.
      It's not compulsory to create a BaseController and use that as an extension for other classes. You can directly extend "Controller" class.
      Still, you can create a BaseController in every SubFolder of Controller folder, and load necessary helpers or libraries.

    • @chaitanyabhallamudi7204
      @chaitanyabhallamudi7204 4 года назад +2

      example:
      1) create a subFolder in App->Controllers.
      2) create two php files a) BaseController.php b)ExampleController.php
      3) Now you can extend CodeIgniter\Controller to BaseController class, like mentioned below:
      use CodeIgniter\Controller;
      class BaseController extends Controller{
      #your code
      }
      4) Then you can extend "BaseController" class to "ExampleController" class, like mentioned below:
      namespace App\Controllers;
      class ExampleController extends BaseController
      {
      #your code
      }

  • @shashithasandunil9464
    @shashithasandunil9464 3 года назад

    Thank you sir

  • @UthpalaBandaradoor
    @UthpalaBandaradoor Год назад

    can't render the php file using segment url. it shows the folder content. but it works when i click index.php how can i solve this?