Why everything works for me in the public / index.php file:
use Controller\ClientsController; $myControl = new ClientsController(); $myControl->hello(); and if, instead of this initialization, I connect the auxiliary file all.php, into which I insert the same lines of the class declaration:
use Controller\ClientsController; require "../src/routes/all.php"; Is the class ClientsController not in it? In fact, the code of the file all.php is inserted into index.php and at the same time everything should work fine, does the path really affect this? What's the catch? Project structure:
`-classes --ClientsController.php -public/ --index.php -src/ --routes/ ---all.php `
use Controller\ClientsController, and thenrequire. Try swapping the strings. - Pavel Sokolov<?php namespace Controller; class ClientsController { public function hello() { echo "Hello true class"; } } ?><?php namespace Controller; class ClientsController { public function hello() { echo "Hello true class"; } } ?><?php namespace Controller; class ClientsController { public function hello() { echo "Hello true class"; } } ?>- cm-brain