PHP two classes use the same namespace and cannot call each other

created two classes, C and D, both of which belong to the same namespace:func,. Instantiate C in the constructor of D and call the cc method in C, and class C under func cannot be found.

ClivedeMBP:Workspace clive$ php D.php 
PHP Fatal error:  Uncaught Error: Class "func\C" not found in /Users/clive/Workspace/D.php:7
Stack trace:
-sharp0 /Users/clive/Workspace/D.php(11): func\D->__construct()
-sharp1 {main}
  thrown in /Users/clive/Workspace/D.php on line 7

Fatal error: Uncaught Error: Class "func\C" not found in /Users/clive/Workspace/D.php on line 7

Error: Class "func\C" not found in /Users/clive/Workspace/D.php on line 7

Call Stack:
    0.0010     352608   1. {main}() /Users/clive/Workspace/D.php:0
    0.0029     352648   2. func\D->__construct() /Users/clive/Workspace/D.php:11

excuse me, how should two classes under the same namespace be written so that they can call each other?

Mar.11,2021

have you loaded C.php?

require('C.php');

use _ _ autoload, or spl_autoload_register to automatically load your class

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea6277-1daa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea6277-1daa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?