Answer the question
In order to leave comments, you need to log in
PHP. From one class is not visible to another. How to fix?
there is such a structure. The dbclass.php file is available, otherwise there would be errors immediately upon startup. However, when I try to use the class from the included file, I get the error Fatal error: Class 'Blackjack\db_write' not found in C:\OpenServer\domains\blackjack\blackjack\blackjack.php
It is clear that it is not being looked for there. ((
<?php
namespace Blackjack;
require ('./dbclass.php');
class BlackJack {
$e = new ClasFrom_dbclass;
}
Answer the question
In order to leave comments, you need to log in
namespace Blackjack;
$e = new ClasFrom_dbclass;
ClasFrom_dbclass
in the current namespace \Blackjack
. This means the full name of the class \Blackjack\ClasFrom_dbclass
. But in fact, the class ClasFrom_dbclass
is apparently located in the global namespace. So you need to address it accordingly $e = new \ClasFrom_dbclass;
(attention to the slash).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question