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)
561
561
*/
562
562
protected function validateRequest (array $ segments )
563
563
{
564
+ $ segments = array_filter ($ segments );
565
+
564
566
$ c = count ($ segments );
565
567
$ directory_override = isset ($ this ->directory );
566
568
@@ -571,8 +573,7 @@ protected function validateRequest(array $segments)
571
573
$ test = $ this ->directory . ucfirst ($ this ->translateURIDashes === true ? str_replace ('- ' , '_ ' , $ segments [0 ]) : $ segments [0 ]
572
574
);
573
575
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 ])))
576
577
{
577
578
$ this ->setDirectory (array_shift ($ segments ), true );
578
579
continue ;
Original file line number Diff line number Diff line change @@ -31,15 +31,15 @@ code.
31
31
32
32
::
33
33
34
- <?php namespace App\Controllers;
35
- use CodeIgniter\Controller;
34
+ <?php namespace App\Controllers;
35
+ use CodeIgniter\Controller;
36
36
37
37
class Pages extends Controller {
38
38
39
- public function index()
40
- {
41
- return view('welcome_message');
42
- }
39
+ public function index()
40
+ {
41
+ return view('welcome_message');
42
+ }
43
43
44
44
public function showme($page = 'home')
45
45
{
@@ -204,12 +204,6 @@ The only uncommented line there to start with should be:::
204
204
This directive says that any incoming request without any content
205
205
specified should be handled by the ``index `` method inside the ``Home `` controller.
206
206
207
- Set the default controller to run your new method:
208
-
209
- ::
210
-
211
- $routes->setDefaultController('Pages/showme');
212
-
213
207
Add the following line, **after ** the route directive for '/'.
214
208
215
209
::
@@ -236,4 +230,4 @@ method in the pages controller? Awesome!
236
230
You should see something like the following:
237
231
238
232
.. image :: ../images/tutorial1.png
239
- :align: center
233
+ :align: center
You can’t perform that action at this time.
0 commit comments