Welcome Guest, Not a member yet? Register   Sign In
BaseController and controller documentation mismatch
#8

(This post was last modified: 04-19-2020, 11:48 AM by jreklund.)

Hi, no worries mate. It's in "CodeIgniter 4 Discussion" after all. :-)

There are nothing stopping you from using http://localhost/HelloWorld, it will find it just fine. But it can't find HelloWorld with http://localhost/helloworld, unless you define it in Config. It also can't find helloworld as we force it to be Helloworld.

You can however type HeLloWoRlD if you like, as long as the file name start with capitalized letter you will be fine.

ucfirst are there to enforce PSR-4 standard, but it dosen't have a built in dictionary, so it dosen't know when to capitalize the next word. That's why the documentation states that you MUST use Helloworld, as it can't find anything else automatically. (with an lowercase url)

You can use this url just fine:
http://localhost/HelloWorld/echoThisMessage

But you will never be able to load HelloWorld with helloworld, that's what the big Note is all about. (Unless manually setting it in Config)

"That's my opinion but I also see that this cannot be change anymore."
I don't know if CodeIgniter 2 did anything different, but the autoloader behaves the same in CodeIgniter 3.
Reply


Messages In This Thread
RE: BaseController and controller documentation mismatch - by jreklund - 04-19-2020, 11:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB