File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed
user_guide_src/source/tutorial Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,8 @@ public function autoRoute(string $uri)
561561 */
562562 protected function validateRequest (array $ segments )
563563 {
564+ $ segments = array_filter ($ segments );
565+
564566 $ c = count ($ segments );
565567 $ directory_override = isset ($ this ->directory );
566568
@@ -571,8 +573,7 @@ protected function validateRequest(array $segments)
571573 $ test = $ this ->directory . ucfirst ($ this ->translateURIDashes === true ? str_replace ('- ' , '_ ' , $ segments [0 ]) : $ segments [0 ]
572574 );
573575
574- if (! is_file (APPPATH . 'Controllers/ ' . $ test . '.php ' ) && $ directory_override === false && is_dir (APPPATH . 'Controllers/ ' . $ this ->directory . ucfirst ($ segments [0 ]))
575- )
576+ if (! is_file (APPPATH . 'Controllers/ ' . $ test . '.php ' ) && $ directory_override === false && is_dir (APPPATH . 'Controllers/ ' . $ this ->directory . ucfirst ($ segments [0 ])))
576577 {
577578 $ this ->setDirectory (array_shift ($ segments ), true );
578579 continue ;
Original file line number Diff line number Diff line change @@ -31,15 +31,15 @@ code.
3131
3232::
3333
34- <?php namespace App\Controllers;
35- use CodeIgniter\Controller;
34+ <?php namespace App\Controllers;
35+ use CodeIgniter\Controller;
3636
3737 class Pages extends Controller {
3838
39- public function index()
40- {
41- return view('welcome_message');
42- }
39+ public function index()
40+ {
41+ return view('welcome_message');
42+ }
4343
4444 public function showme($page = 'home')
4545 {
@@ -204,12 +204,6 @@ The only uncommented line there to start with should be:::
204204This directive says that any incoming request without any content
205205specified should be handled by the ``index `` method inside the ``Home `` controller.
206206
207- Set the default controller to run your new method:
208-
209- ::
210-
211- $routes->setDefaultController('Pages/showme');
212-
213207Add the following line, **after ** the route directive for '/'.
214208
215209::
@@ -236,4 +230,4 @@ method in the pages controller? Awesome!
236230You should see something like the following:
237231
238232.. image :: ../images/tutorial1.png
239- :align: center
233+ :align: center
You can’t perform that action at this time.
0 commit comments