Welcome Guest, Not a member yet? Register   Sign In
unexpected route problem
#6

(05-02-2023, 03:42 PM)iRedds Wrote: What are you new to? In php?

In the first example, the handler is specified as a string. In this case, the class will be checked for the existence of a namespace, and if it is not found, the default namespace will be added.

In the second example, you specify the handler as a string, where you declare the class name directly. If you don't specify a namespace or don't import, the current namespace will be used.
Current namespace is Config.

PHP Code:
namespace Config;

use Namespace\
Example2

$routes->get('example1', [Example1::class, 'index']); // \Config\Example1
$routes->get('example2', [Example2::class, 'index']); // \Namespace\Example2
$routes->get('example3', ['\Namespace\Example3''index']); // \Namespace\Example3

$routes->get('example4''\Namespace\Example4::index'); //  \Namespace\Example4
$routes->get('example5''Namespace\Example5::index'); //  \App\Controllers\Namespace\Example5 

Thank you for explaining in such a manner.
the problem is solved
Reply


Messages In This Thread
unexpected route problem - by anuragk - 05-02-2023, 07:00 AM
RE: unexpected route problem - by iRedds - 05-02-2023, 07:09 AM
RE: unexpected route problem - by anuragk - 05-02-2023, 07:13 AM
RE: unexpected route problem - by iRedds - 05-02-2023, 03:42 PM
RE: unexpected route problem - by anuragk - 05-02-2023, 10:11 PM
RE: unexpected route problem - by kenjis - 05-02-2023, 05:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB